Github   Telegram
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
cache::LruCacheWrapper< Key, Value, Hash, Equal > Class Template Referencefinal

Public Types

using Cache = ExpirableLruCache< Key, Value, Hash, Equal >
 
using ReadMode = typename Cache::ReadMode
 

Public Member Functions

 LruCacheWrapper (std::shared_ptr< Cache > cache, typename Cache::UpdateValueFunc update_func)
 
Value Get (const Key &key, ReadMode read_mode=ReadMode::kUseCache)
 Get cached value or evaluates if "key" is missing in cache. More...
 
std::optional< Value > GetOptional (const Key &key)
 Get cached value or "nullopt" if "key" is missing in cache. More...
 
void InvalidateByKey (const Key &key)
 
void UpdateInBackground (const Key &key)
 Update cached value in background. More...
 
std::shared_ptr< CacheGetCache ()
 Get raw cache. For internal use. More...
 

Detailed Description

template<typename Key, typename Value, typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
class cache::LruCacheWrapper< Key, Value, Hash, Equal >

Definition at line 351 of file expirable_lru_cache.hpp.

Member Typedef Documentation

◆ Cache

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
using cache::LruCacheWrapper< Key, Value, Hash, Equal >::Cache = ExpirableLruCache<Key, Value, Hash, Equal>

Definition at line 353 of file expirable_lru_cache.hpp.

◆ ReadMode

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
using cache::LruCacheWrapper< Key, Value, Hash, Equal >::ReadMode = typename Cache::ReadMode

Definition at line 354 of file expirable_lru_cache.hpp.

Constructor & Destructor Documentation

◆ LruCacheWrapper()

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
cache::LruCacheWrapper< Key, Value, Hash, Equal >::LruCacheWrapper ( std::shared_ptr< Cache cache,
typename Cache::UpdateValueFunc  update_func 
)
inline

Definition at line 356 of file expirable_lru_cache.hpp.

Member Function Documentation

◆ Get()

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
Value cache::LruCacheWrapper< Key, Value, Hash, Equal >::Get ( const Key &  key,
ReadMode  read_mode = ReadMode::kUseCache 
)
inline

Get cached value or evaluates if "key" is missing in cache.

Definition at line 361 of file expirable_lru_cache.hpp.

◆ GetCache()

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
std::shared_ptr< Cache > cache::LruCacheWrapper< Key, Value, Hash, Equal >::GetCache ( )
inline

Get raw cache. For internal use.

Definition at line 378 of file expirable_lru_cache.hpp.

◆ GetOptional()

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
std::optional< Value > cache::LruCacheWrapper< Key, Value, Hash, Equal >::GetOptional ( const Key &  key)
inline

Get cached value or "nullopt" if "key" is missing in cache.

Definition at line 366 of file expirable_lru_cache.hpp.

◆ InvalidateByKey()

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
void cache::LruCacheWrapper< Key, Value, Hash, Equal >::InvalidateByKey ( const Key &  key)
inline

Definition at line 370 of file expirable_lru_cache.hpp.

◆ UpdateInBackground()

template<typename Key , typename Value , typename Hash = std::hash<Key>, typename Equal = std::equal_to<Key>>
void cache::LruCacheWrapper< Key, Value, Hash, Equal >::UpdateInBackground ( const Key &  key)
inline

Update cached value in background.

Definition at line 373 of file expirable_lru_cache.hpp.


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