diff options
| author | lavrinovich <[email protected]> | 2023-11-07 16:55:34 +0300 |
|---|---|---|
| committer | lavrinovich <[email protected]> | 2023-11-07 17:25:14 +0300 |
| commit | d2de62164bfaeedfd9a65c5e0e2adfd748ab1f37 (patch) | |
| tree | a9943b9dc6c096d68c844e16505af9dd9a757899 | |
| parent | b1972492282e41abaf605831cd634765db80d2c8 (diff) | |
Shared LM weight cache
| -rw-r--r-- | yt/yt/core/misc/sync_cache-inl.h | 11 | ||||
| -rw-r--r-- | yt/yt/core/misc/sync_cache.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/yt/yt/core/misc/sync_cache-inl.h b/yt/yt/core/misc/sync_cache-inl.h index bd80cfa1e0b..ef675192d1f 100644 --- a/yt/yt/core/misc/sync_cache-inl.h +++ b/yt/yt/core/misc/sync_cache-inl.h @@ -142,13 +142,14 @@ TSyncSlruCacheBase<TKey, TValue, THash>::Find(const TKey& key) template <class TKey, class TValue, class THash> std::vector<typename TSyncSlruCacheBase<TKey, TValue, THash>::TValuePtr> -TSyncSlruCacheBase<TKey, TValue, THash>::GetAll() +TSyncSlruCacheBase<TKey, TValue, THash>::GetAll() const { std::vector<TValuePtr> result; - result.reseve(GetSize()); - for (const auto& shard : Shards_) { - auto guard = ReaderGuard(shard->SpinLock); - for (const auto& [key, item] : shard->ItemMap) { + result.reserve(GetSize()); + for (int index = 0; index < Config_->ShardCount; ++index) { + const auto& shard = Shards_[index]; + auto guard = ReaderGuard(shard.SpinLock); + for (const auto& [key, item] : shard.ItemMap) { result.push_back(item->Value); } } diff --git a/yt/yt/core/misc/sync_cache.h b/yt/yt/core/misc/sync_cache.h index 399dec86be0..ab02908bc09 100644 --- a/yt/yt/core/misc/sync_cache.h +++ b/yt/yt/core/misc/sync_cache.h @@ -42,7 +42,7 @@ public: using TValuePtr = TIntrusivePtr<TValue>; int GetSize() const; - std::vector<TValuePtr> GetAll(); + std::vector<TValuePtr> GetAll() const; TValuePtr Find(const TKey& key); |
