aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/cache/cache.h
diff options
context:
space:
mode:
authorVlad Yaroslavlev <vladon@vladon.com>2022-02-10 16:46:25 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:25 +0300
commit344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/cache/cache.h
parent706b83ed7de5a473436620367af31fc0ceecde07 (diff)
downloadydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 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 f79be81fa5..6dc997076d 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 {
}
};