diff options
author | kikht <kikht@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
commit | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /library/cpp/cache/cache.h | |
parent | 194cae0e8855b11be2005e1eff12c660c3ee9774 (diff) | |
download | ydb-778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5.tar.gz |
Restoring authorship annotation for <kikht@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/cache/cache.h')
-rw-r--r-- | library/cpp/cache/cache.h | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/library/cpp/cache/cache.h b/library/cpp/cache/cache.h index c5231e42d3..6dc997076d 100644 --- a/library/cpp/cache/cache.h +++ b/library/cpp/cache/cache.h @@ -101,20 +101,20 @@ public: return ItemsAmount; } - size_t GetTotalSize() const { - return TotalSize; - } - - size_t GetMaxSize() const { - return MaxSize; - } - - // It does not remove current items if newSize is less than TotalSize. - // Caller should use RemoveIfOverflown to clean up list in this case - void SetMaxSize(size_t newSize) { - MaxSize = newSize; - } - + size_t GetTotalSize() const { + return TotalSize; + } + + size_t GetMaxSize() const { + return MaxSize; + } + + // It does not remove current items if newSize is less than TotalSize. + // Caller should use RemoveIfOverflown to clean up list in this case + void SetMaxSize(size_t newSize) { + MaxSize = newSize; + } + private: typedef TIntrusiveList<TItem> TListType; TListType List; @@ -212,16 +212,16 @@ public: return ListSize; } - size_t GetMaxSize() const { - return MaxSize; - } - - // It does not remove current items if newSize is less than TotalSize. - // Caller should use RemoveIfOverflown to clean up list in this case - void SetMaxSize(size_t newSize) { - MaxSize = newSize; - } - + size_t GetMaxSize() const { + return MaxSize; + } + + // It does not remove current items if newSize is less than TotalSize. + // Caller should use RemoveIfOverflown to clean up list in this case + void SetMaxSize(size_t newSize) { + MaxSize = newSize; + } + private: typedef TIntrusiveList<TItem> TListType; TListType List; @@ -333,16 +333,16 @@ public: return Size; } - size_t GetMaxSize() const { - return MaxSize; - } - - // It does not remove current items if newSize is less than TotalSize. - // Caller should use RemoveIfOverflown to clean up list in this case - void SetMaxSize(size_t newSize) { - MaxSize = newSize; - } - + size_t GetMaxSize() const { + return MaxSize; + } + + // It does not remove current items if newSize is less than TotalSize. + // Caller should use RemoveIfOverflown to clean up list in this case + void SetMaxSize(size_t newSize) { + MaxSize = newSize; + } + void Clear() { Heap.clear(); Removed.clear(); @@ -531,20 +531,20 @@ public: Index.clear(); } - void SetMaxSize(size_t newSize) { - List.SetMaxSize(newSize); - - TItem* removedItem = nullptr; - while ((removedItem = List.RemoveIfOverflown())) { - EraseFromIndex(removedItem); - } - Y_ASSERT(Index.size() == List.GetSize()); - } - - size_t GetMaxSize() const { - return List.GetMaxSize(); - } - + void SetMaxSize(size_t newSize) { + List.SetMaxSize(newSize); + + TItem* removedItem = nullptr; + while ((removedItem = List.RemoveIfOverflown())) { + EraseFromIndex(removedItem); + } + Y_ASSERT(Index.size() == List.GetSize()); + } + + size_t GetMaxSize() const { + return List.GetMaxSize(); + } + protected: TIndex Index; TListType List; @@ -595,10 +595,10 @@ public: TIterator FindOldest() { return TBase::Empty() ? TBase::End() : this->FindByItem(TBase::List.GetOldest()); } - + size_t TotalSize() const { - return TBase::List.GetTotalSize(); - } + return TBase::List.GetTotalSize(); + } }; template <typename TKey, typename TValue, typename TDeleter = TNoopDelete> |