Cachemere
Modular Caching Library for C++
Public Member Functions | List of all members
cachemere::policy::InsertionAlways< Key, KeyHash, Value > Class Template Reference

Simplest insertion policy. Always accepts insertions. More...

#include <insertion_always.h>

Public Member Functions

void clear ()
 Clears the policy.
 
bool should_add (const Key &key)
 Determines whether a given key should be inserted into the cache. More...
 
bool should_replace (const Key &victim, const Key &candidate)
 Determines whether a given victim should be replaced by a given candidate. More...
 

Detailed Description

template<typename Key, typename KeyHash, typename Value>
class cachemere::policy::InsertionAlways< Key, KeyHash, Value >

Simplest insertion policy. Always accepts insertions.

Template Parameters
KeyThe type of the keys used to identify items in the cache.
KeyHashThe type of the hasher used to hash item keys.
ValueThe type of the values stored in the cache.

Member Function Documentation

◆ should_add()

template<typename Key , typename KeyHash , typename Value >
bool cachemere::policy::InsertionAlways< Key, KeyHash, Value >::should_add ( const Key &  key)

Determines whether a given key should be inserted into the cache.

For this policy, should_add always returns true.

Parameters
keyThe key of the insertion candidate.
Returns
Whether the candidate should be inserted into the cache.

◆ should_replace()

template<typename Key , typename KeyHash , typename Value >
bool cachemere::policy::InsertionAlways< Key, KeyHash, Value >::should_replace ( const Key &  victim,
const Key &  candidate 
)

Determines whether a given victim should be replaced by a given candidate.

For this policy, should_replace always returns true.

Parameters
victimThe key of the victim the candidate will be compared to.
candidateThe key of the insertion candidate.
Returns
Whether the victim should be replaced by the candidate.

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