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