6#include <userver/cache/impl/lru.hpp>
15template <
typename T,
typename Hash = std::hash<T>,
16 typename Equal = std::equal_to<T>>
19 explicit LruSet(size_t max_size,
const Hash& hash = Hash(),
20 const Equal& equal = Equal())
21 : impl_(max_size, hash, equal) {}
23 LruSet(LruSet&& lru)
noexcept =
default;
24 LruSet(
const LruSet& lru) =
delete;
25 LruSet& operator=(LruSet&& lru)
noexcept =
default;
26 LruSet& operator=(
const LruSet& lru) =
delete;
30 bool Put(
const T& key) {
return impl_.Put(key, {}); }
33 void Erase(
const T& key) {
return impl_.Erase(key); }
36 bool Has(
const T& key) {
return impl_.Get(key); }
40 return impl_.SetMaxSize(new_max_size);
47 template <
typename Function>
50 [&func](
const auto& key,
const auto& )
mutable { func(key); });
53 size_t GetSize()
const {
return impl_.GetSize(); }
61 impl::LruBase<T,
impl::EmptyPlaceholder, Hash, Equal> impl_;