Github   Telegram
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
cache::NWayLRU< T, U, Hash, Equal > Class Template Referencefinal

Public Member Functions

 NWayLRU (size_t ways, size_t way_size, const Hash &hash=Hash(), const Equal &equal=Equal())
 
void Put (const T &key, U value)
 
template<typename Validator >
std::optional< U > Get (const T &key, Validator validator)
 
std::optional< U > Get (const T &key)
 
GetOr (const T &key, const U &default_value)
 
void Invalidate ()
 
void InvalidateByKey (const T &key)
 
template<typename Function >
void VisitAll (Function func) const
 Iterates over all items. May be slow for big caches. More...
 
size_t GetSize () const
 
void UpdateWaySize (size_t way_size)
 

Detailed Description

template<typename T, typename U, typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
class cache::NWayLRU< T, U, Hash, Equal >

Definition at line 17 of file nway_lru_cache.hpp.

Constructor & Destructor Documentation

◆ NWayLRU()

template<typename T , typename U , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
cache::NWayLRU< T, U, Hash, Eq >::NWayLRU ( size_t  ways,
size_t  way_size,
const Hash &  hash = Hash(),
const Equal &  equal = Equal() 
)

Definition at line 63 of file nway_lru_cache.hpp.

Member Function Documentation

◆ Get() [1/2]

template<typename T , typename U , typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
std::optional< U > cache::NWayLRU< T, U, Hash, Equal >::Get ( const T &  key)
inline

Definition at line 27 of file nway_lru_cache.hpp.

◆ Get() [2/2]

template<typename T , typename U , typename Hash , typename Eq >
template<typename Validator >
std::optional< U > cache::NWayLRU< T, U, Hash, Eq >::Get ( const T &  key,
Validator  validator 
)

Definition at line 83 of file nway_lru_cache.hpp.

◆ GetOr()

template<typename T , typename U , typename Hash , typename Eq >
U cache::NWayLRU< T, U, Hash, Eq >::GetOr ( const T &  key,
const U &  default_value 
)

Definition at line 105 of file nway_lru_cache.hpp.

◆ GetSize()

template<typename T , typename U , typename Hash , typename Eq >
size_t cache::NWayLRU< T, U, Hash, Eq >::GetSize

Definition at line 129 of file nway_lru_cache.hpp.

◆ Invalidate()

template<typename T , typename U , typename Hash , typename Eq >
void cache::NWayLRU< T, U, Hash, Eq >::Invalidate

Definition at line 112 of file nway_lru_cache.hpp.

◆ InvalidateByKey()

template<typename T , typename U , typename Hash , typename Eq >
void cache::NWayLRU< T, U, Hash, Eq >::InvalidateByKey ( const T &  key)

Definition at line 98 of file nway_lru_cache.hpp.

◆ Put()

template<typename T , typename U , typename Hash , typename Eq >
void cache::NWayLRU< T, U, Hash, Eq >::Put ( const T &  key,
value 
)

Definition at line 74 of file nway_lru_cache.hpp.

◆ UpdateWaySize()

template<typename T , typename U , typename Hash , typename Eq >
void cache::NWayLRU< T, U, Hash, Eq >::UpdateWaySize ( size_t  way_size)

Definition at line 139 of file nway_lru_cache.hpp.

◆ VisitAll()

template<typename T , typename U , typename Hash , typename Eq >
template<typename Function >
void cache::NWayLRU< T, U, Hash, Eq >::VisitAll ( Function  func) const

Iterates over all items. May be slow for big caches.

Definition at line 121 of file nway_lru_cache.hpp.


The documentation for this class was generated from the following file: