Electroneum
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
caches::fixed_sized_cache< Key, Value, Policy > Class Template Reference

#include <cache.hpp>

Collaboration diagram for caches::fixed_sized_cache< Key, Value, Policy >:
Collaboration graph
[legend]

Public Types

using iterator = typename std::unordered_map< Key, Value >::iterator
 
using const_iterator = typename std::unordered_map< Key, Value >::const_iterator
 
using operation_guard = typename std::lock_guard< std::mutex >
 

Public Member Functions

 fixed_sized_cache (size_t max_size, const Policy &policy=Policy())
 
void Put (const Key &key, const Value &value)
 
bool Contains (const Key &key)
 
const Value & Get (const Key &key) const
 
const size_t Size () const
 
void Clear ()
 

Protected Member Functions

void Insert (const Key &key, const Value &value)
 
void Erase (const Key &key)
 
void Update (const Key &key, const Value &value)
 
const_iterator FindElem (const Key &key) const
 

Private Attributes

std::unordered_map< Key, Value > cache_items_map
 
Policy cache_policy
 
std::mutex safe_op
 
size_t max_cache_size
 

Member Typedef Documentation

◆ const_iterator

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
using caches::fixed_sized_cache< Key, Value, Policy >::const_iterator = typename std::unordered_map<Key, Value>::const_iterator

◆ iterator

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
using caches::fixed_sized_cache< Key, Value, Policy >::iterator = typename std::unordered_map<Key, Value>::iterator

◆ operation_guard

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
using caches::fixed_sized_cache< Key, Value, Policy >::operation_guard = typename std::lock_guard<std::mutex>

Constructor & Destructor Documentation

◆ fixed_sized_cache()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
caches::fixed_sized_cache< Key, Value, Policy >::fixed_sized_cache ( size_t  max_size,
const Policy &  policy = Policy() 
)
inline

Member Function Documentation

◆ Clear()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
void caches::fixed_sized_cache< Key, Value, Policy >::Clear ( )
inline

◆ Contains()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
bool caches::fixed_sized_cache< Key, Value, Policy >::Contains ( const Key &  key)
inline

◆ Erase()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
void caches::fixed_sized_cache< Key, Value, Policy >::Erase ( const Key &  key)
inlineprotected

◆ FindElem()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
const_iterator caches::fixed_sized_cache< Key, Value, Policy >::FindElem ( const Key &  key) const
inlineprotected

◆ Get()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
const Value& caches::fixed_sized_cache< Key, Value, Policy >::Get ( const Key &  key) const
inline

◆ Insert()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
void caches::fixed_sized_cache< Key, Value, Policy >::Insert ( const Key &  key,
const Value &  value 
)
inlineprotected

◆ Put()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
void caches::fixed_sized_cache< Key, Value, Policy >::Put ( const Key &  key,
const Value &  value 
)
inline

◆ Size()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
const size_t caches::fixed_sized_cache< Key, Value, Policy >::Size ( ) const
inline

◆ Update()

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
void caches::fixed_sized_cache< Key, Value, Policy >::Update ( const Key &  key,
const Value &  value 
)
inlineprotected

Member Data Documentation

◆ cache_items_map

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
std::unordered_map<Key, Value> caches::fixed_sized_cache< Key, Value, Policy >::cache_items_map
private

◆ cache_policy

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
Policy caches::fixed_sized_cache< Key, Value, Policy >::cache_policy
mutableprivate

◆ max_cache_size

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
size_t caches::fixed_sized_cache< Key, Value, Policy >::max_cache_size
private

◆ safe_op

template<typename Key , typename Value , typename Policy = NoCachePolicy<Key>>
std::mutex caches::fixed_sized_cache< Key, Value, Policy >::safe_op
mutableprivate

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