6#include <userver/cache/impl/lru.hpp>
15template <
typename T,
typename Hash = std::hash<T>,
typename Equal = std::equal_to<T>>
18 explicit LruSet(size_t max_size,
const Hash& hash = Hash(),
const Equal& equal = Equal())
19 : impl_(max_size, hash, equal) {}
21 LruSet(LruSet&& lru)
noexcept =
default;
22 LruSet(
const LruSet& lru) =
delete;
23 LruSet& operator=(LruSet&& lru)
noexcept =
default;
24 LruSet& operator=(
const LruSet& lru) =
delete;
28 bool Put(
const T& key) {
return impl_.Put(key, {}); }
31 void Erase(
const T& key) {
return impl_.Erase(key); }
34 bool Has(
const T& key) {
return impl_.Get(key); }
37 void SetMaxSize(size_t new_max_size) {
return impl_.SetMaxSize(new_max_size); }
43 template <
typename Function>
45 impl_.VisitAll([&func](
const auto& key,
const auto& )
mutable { func(key); });
48 size_t GetSize()
const {
return impl_.GetSize(); }
56 impl::LruBase<T, impl::EmptyPlaceholder, Hash, Equal> impl_;