PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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)
 
size_t max_size () const
 
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 16 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 19 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 27 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

Definition at line 37 of file unordered_lru_cache.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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 85 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 49 of file unordered_lru_cache.h.

Here is the call graph for this function:

◆ 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

Definition at line 80 of file unordered_lru_cache.h.

◆ 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 70 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

Definition at line 59 of file unordered_lru_cache.h.

Here is the caller graph for this function:

◆ insert()

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

Definition at line 54 of file unordered_lru_cache.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ max_size()

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 >::max_size ( ) const
inline

Definition at line 34 of file unordered_lru_cache.h.

◆ 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

Definition at line 91 of file unordered_lru_cache.h.

Here is the caller graph for this function:

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

Definition at line 24 of file unordered_lru_cache.h.

◆ cacheMap

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

Definition at line 21 of file unordered_lru_cache.h.

◆ 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

Definition at line 22 of file unordered_lru_cache.h.

◆ 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

Definition at line 23 of file unordered_lru_cache.h.


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