Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold > Class Template Reference

#include <unordered_lru_cache.h>

Public Member Functions

 unordered_lru_cache (size_t _maxSize=MaxSize, size_t _truncateThreshold=TruncateThreshold)
 
template<typename Value2 >
void _emplace (const Key &key, Value2 &&v)
 
void emplace (const Key &key, Value &&v)
 
void insert (const Key &key, const Value &v)
 
bool get (const Key &key, Value &value)
 
bool exists (const Key &key)
 
void erase (const Key &key)
 
void clear ()
 

Private Types

typedef std::unordered_map< Key, std::pair< Value, int64_t >, Hasher > MapType
 

Private Member Functions

void truncate_if_needed ()
 

Private Attributes

MapType cacheMap
 
size_t maxSize
 
size_t truncateThreshold
 
int64_t accessCounter {0}
 

Detailed Description

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
class unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >

Definition at line 11 of file unordered_lru_cache.h.

Member Typedef Documentation

◆ MapType

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
typedef std::unordered_map<Key, std::pair<Value, int64_t>, Hasher> unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::MapType
private

Definition at line 14 of file unordered_lru_cache.h.

Constructor & Destructor Documentation

◆ unordered_lru_cache()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::unordered_lru_cache ( size_t  _maxSize = MaxSize,
size_t  _truncateThreshold = TruncateThreshold 
)
inlineexplicit

Definition at line 22 of file unordered_lru_cache.h.

Member Function Documentation

◆ _emplace()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
template<typename Value2 >
void unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::_emplace ( const Key &  key,
Value2 &&  v 
)
inline

◆ clear()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
void unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::clear ( )
inline

Definition at line 80 of file unordered_lru_cache.h.

◆ emplace()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
void unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::emplace ( const Key &  key,
Value &&  v 
)
inline

Definition at line 44 of file unordered_lru_cache.h.

◆ erase()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
void unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::erase ( const Key &  key)
inline

◆ exists()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
bool unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::exists ( const Key &  key)
inline

Definition at line 65 of file unordered_lru_cache.h.

◆ get()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
bool unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::get ( const Key &  key,
Value &  value 
)
inline

◆ insert()

◆ truncate_if_needed()

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
void unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::truncate_if_needed ( )
inlineprivate

Member Data Documentation

◆ accessCounter

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
int64_t unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::accessCounter {0}
private

◆ cacheMap

◆ maxSize

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
size_t unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::maxSize
private

◆ truncateThreshold

template<typename Key, typename Value, typename Hasher, size_t MaxSize = 0, size_t TruncateThreshold = 0>
size_t unordered_lru_cache< Key, Value, Hasher, MaxSize, TruncateThreshold >::truncateThreshold
private

The documentation for this class was generated from the following file:
Released under the MIT license