aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/cache/cache.h
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:23 +0300
commit706b83ed7de5a473436620367af31fc0ceecde07 (patch)
tree103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/cache/cache.h
parent918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff)
downloadydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/cache/cache.h')
-rw-r--r--library/cpp/cache/cache.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/library/cpp/cache/cache.h b/library/cpp/cache/cache.h
index 6dc997076d..f79be81fa5 100644
--- a/library/cpp/cache/cache.h
+++ b/library/cpp/cache/cache.h
@@ -81,7 +81,7 @@ public:
}
TItem* GetOldest() {
- typename TListType::TIterator it = List.Begin();
+ typename TListType::TIterator it = List.Begin();
Y_ASSERT(it != List.End());
return &*it;
}
@@ -116,8 +116,8 @@ public:
}
private:
- typedef TIntrusiveList<TItem> TListType;
- TListType List;
+ typedef TIntrusiveList<TItem> TListType;
+ TListType List;
TSizeProvider SizeProvider;
size_t ItemsAmount;
size_t TotalSize;
@@ -189,7 +189,7 @@ public:
}
TItem* GetLeastFrequentlyUsed() {
- typename TListType::TIterator it = List.Begin();
+ typename TListType::TIterator it = List.Begin();
Y_ASSERT(it != List.End());
return &*it;
}
@@ -201,7 +201,7 @@ public:
void Promote(TItem* item) {
size_t counter = ++item->Counter;
- typename TListType::TIterator it = item;
+ typename TListType::TIterator it = item;
while (it != List.End() && counter >= it->Counter) {
++it;
}
@@ -223,8 +223,8 @@ public:
}
private:
- typedef TIntrusiveList<TItem> TListType;
- TListType List;
+ typedef TIntrusiveList<TItem> TListType;
+ TListType List;
size_t ListSize;
size_t MaxSize;
};
@@ -366,18 +366,18 @@ private:
}
private:
- TVector<TItem*> Heap;
- THashSet<TItem*> Removed;
+ TVector<TItem*> Heap;
+ THashSet<TItem*> Removed;
size_t Size;
size_t MaxSize;
};
-template <typename TKey, typename TValue, typename TListType, typename TDeleter>
+template <typename TKey, typename TValue, typename TListType, typename TDeleter>
class TCache {
- typedef typename TListType::TItem TItem;
+ typedef typename TListType::TItem TItem;
typedef typename TItem::THash THash;
- typedef THashMultiSet<TItem, THash> TIndex;
+ typedef THashMultiSet<TItem, THash> TIndex;
typedef typename TIndex::iterator TIndexIterator;
typedef typename TIndex::const_iterator TIndexConstIterator;
@@ -418,7 +418,7 @@ public:
return Iter->Value;
}
- friend class TCache<TKey, TValue, TListType, TDeleter>;
+ friend class TCache<TKey, TValue, TListType, TDeleter>;
private:
TIndexConstIterator Iter;
@@ -547,7 +547,7 @@ public:
protected:
TIndex Index;
- TListType List;
+ TListType List;
bool MultiValue;
TIterator FindByItem(TItem* item) {
@@ -570,7 +570,7 @@ protected:
struct TNoopDelete {
template <class T>
- static inline void Destroy(const T&) noexcept {
+ static inline void Destroy(const T&) noexcept {
}
};