Cachemere
Modular Caching Library for C++
|
1 namespace cachemere::policy {
3 template<
class K,
class KH,
class V> ConstraintCount<K, KH, V>::ConstraintCount(
size_t maximum_count)
15 return m_count < m_maximum_count;
18 template<
class K,
class KH,
class V>
29 return m_count <= m_maximum_count;
34 m_maximum_count = maximum_count;
55 return m_maximum_count;
size_t count() const
Get the number of items currently in the cache.
Definition: constraint_count.hpp:48
void clear()
Clears the policy.
Definition: constraint_count.hpp:8
A wrapper for items stored in the cache.
Definition: item.h:10
bool is_satisfied()
Returns whether the constraint is satisfied.
Definition: constraint_count.hpp:27
bool can_replace(const Key &key, const CacheItem &old_item, const CacheItem &new_item)
Determines whether an item already in cache can be updated.
Definition: constraint_count.hpp:19
void on_evict(const Key &key, const CacheItem &item)
Eviction event handler.
Definition: constraint_count.hpp:42
size_t maximum_count() const
Get the maximum number of items allowed in cache.
Definition: constraint_count.hpp:53
void on_insert(const Key &key, const CacheItem &item)
Insertion event handler.
Definition: constraint_count.hpp:37
void update(size_t maximum_count)
Update the cache constraint.
Definition: constraint_count.hpp:32
bool can_add(const Key &key, const CacheItem &item)
Determines whether an insertion candidate can be added into the cache.
Definition: constraint_count.hpp:13