diff options
author | grmammaev <grmammaev@yandex-team.ru> | 2022-02-10 16:50:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:15 +0300 |
commit | 3d636b3ac8d1e635bba5c5007da7a6d81f2c17f4 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp | |
parent | 648ad4dca7675cb9f970491c5df0e86aaefd5c3e (diff) | |
download | ydb-3d636b3ac8d1e635bba5c5007da7a6d81f2c17f4.tar.gz |
Restoring authorship annotation for <grmammaev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/cache/thread_safe_cache.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/library/cpp/cache/thread_safe_cache.h b/library/cpp/cache/thread_safe_cache.h index b7c71d8ff1..71e1442717 100644 --- a/library/cpp/cache/thread_safe_cache.h +++ b/library/cpp/cache/thread_safe_cache.h @@ -62,19 +62,19 @@ namespace NPrivate { Cache.Clear(); } - void Erase(TArgs... args) { - Key key = Callbacks.GetKey(args...); + void Erase(TArgs... args) { + Key key = Callbacks.GetKey(args...); if (!Contains(key)) { return; - } - TWriteGuard w(Mutex); - typename TInternalCache::TIterator i = Cache.Find(key); - if (i == Cache.End()) { - return; - } - Cache.Erase(i); - } - + } + TWriteGuard w(Mutex); + typename TInternalCache::TIterator i = Cache.Find(key); + if (i == Cache.End()) { + return; + } + Cache.Erase(i); + } + bool Contains(const Key& key) const { TReadGuard r(Mutex); auto iter = Cache.FindWithoutPromote(key); @@ -87,11 +87,11 @@ namespace NPrivate { } template <class TCallbacks> - static const TPtr Erase(TArgs... args) { - return TThreadSafeCacheSingleton<TCallbacks>::Erase(args...); - } - - template <class TCallbacks> + static const TPtr Erase(TArgs... args) { + return TThreadSafeCacheSingleton<TCallbacks>::Erase(args...); + } + + template <class TCallbacks> static void Clear() { return TThreadSafeCacheSingleton<TCallbacks>::Clear(); } @@ -144,10 +144,10 @@ namespace NPrivate { return Singleton<TThreadSafeCacheSingleton>()->Cache.Get(args...); } - static const TPtr Erase(TArgs... args) { - return Singleton<TThreadSafeCacheSingleton>()->Cache.Erase(args...); - } - + static const TPtr Erase(TArgs... args) { + return Singleton<TThreadSafeCacheSingleton>()->Cache.Erase(args...); + } + static void Clear() { return Singleton<TThreadSafeCacheSingleton>()->Cache.Clear(); } |