Cachemere
Modular Caching Library for C++
|
Memory-constrained cache presets. More...
Typedefs | |
template<typename Key , typename Value , template< class, class, class > class InsertionPolicy, template< class, class, class > class EvictionPolicy, typename MeasureValue = measurement::Size<Value>, typename MeasureKey = measurement::Size<Key>, typename KeyHash = absl::Hash<Key>, bool ThreadSafe = true> | |
using | MemoryConstrainedCache = Cache< Key, Value, InsertionPolicy, EvictionPolicy, policy::ConstraintMemory, MeasureValue, MeasureKey, KeyHash, ThreadSafe > |
template<typename Key , typename Value , typename MeasureValue = measurement::Size<Value>, typename MeasureKey = measurement::Size<Key>, typename KeyHash = absl::Hash<Key>, bool ThreadSafe = true> | |
using | LRUCache = MemoryConstrainedCache< Key, Value, policy::InsertionAlways, policy::EvictionLRU, MeasureValue, MeasureKey, KeyHash, ThreadSafe > |
Least-Recently-Used Cache. More... | |
template<typename Key , typename Value , typename MeasureValue = measurement::Size<Value>, typename MeasureKey = measurement::Size<Key>, typename KeyHash = absl::Hash<Key>, bool ThreadSafe = true> | |
using | TinyLFUCache = MemoryConstrainedCache< Key, Value, policy::InsertionTinyLFU, policy::EvictionSegmentedLRU, MeasureValue, MeasureKey, KeyHash, ThreadSafe > |
TinyLFU Cache. More... | |
template<typename Key , typename Value , typename Cost , typename MeasureValue = measurement::Size<Value>, typename MeasureKey = measurement::Size<Key>, typename KeyHash = absl::Hash<Key>, bool ThreadSafe = true> | |
using | CustomCostCache = MemoryConstrainedCache< Key, Value, policy::InsertionAlways, policy::bind< policy::EvictionGDSF, Cost >::template ttype, MeasureValue, MeasureKey, KeyHash, ThreadSafe > |
Custom-Cost Cache. More... | |
Memory-constrained cache presets.
using cachemere::presets::memory::CustomCostCache = typedef MemoryConstrainedCache<Key, Value, policy::InsertionAlways, policy::bind<policy::EvictionGDSF, Cost>::template ttype, MeasureValue, MeasureKey, KeyHash, ThreadSafe> |
Custom-Cost Cache.
The use of this cache should be favored in scenarios where the cost of a cache miss varies greatly from one item to the next.
Key | The type of the key used for retrieving items. |
Value | The type of the items stored in the cache. |
Cost | A functor taking a const Item<Key, Value>& returning the cost to load this item in cache. |
MeasureValue | A functor returning the size of a cache value. |
MeasureKey | A functor returning the size of a cache key. |
KeyHash | A default-constructible callable type returning a hash of a key. Defaults to absl::Hash<Key> . |
ThreadSafe | Whether to protect this cache for concurrent access. (true by default) |
using cachemere::presets::memory::LRUCache = typedef MemoryConstrainedCache<Key, Value, policy::InsertionAlways, policy::EvictionLRU, MeasureValue, MeasureKey, KeyHash, ThreadSafe> |
Least-Recently-Used Cache.
Uses a linked list to order items from hottest (most recently accessed) to coldest (least recently accessed).
Key | The type of the key used for retrieving items. |
Value | The type of the items stored in the cache. |
MeasureValue | A functor returning the size of a cache value. |
MeasureKey | A functor returning the size of a cache key. |
KeyHash | A default-constructible callable type returning a hash of a key. Defaults to absl::Hash<Key> . |
ThreadSafe | Whether to protect this cache for concurrent access. (true by default) |
using cachemere::presets::memory::TinyLFUCache = typedef MemoryConstrainedCache<Key, Value, policy::InsertionTinyLFU, policy::EvictionSegmentedLRU, MeasureValue, MeasureKey, KeyHash, ThreadSafe> |
TinyLFU Cache.
Uses a combination of frequency sketches to gather a decent estimate of the access frequency of most keys. Uses this estimate to decide which item should be held in cache over another.
Key | The type of the key used for retrieving items. |
Value | The type of the items stored in the cache. |
MeasureValue | A functor returning the size of a cache value. |
MeasureKey | A functor returning the size of a cache key. |
KeyHash | A default-constructible callable type returning a hash of a key. Defaults to absl::Hash<Key> . |
ThreadSafe | Whether to protect this cache for concurrent access. (true by default) |