Caches 0.1.0
LRU/LFU/FIFO Caches library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
caches::ICachePolicy< Key > Class Template Referenceabstract

Cache policy abstract base class. More...

#include <cache_policy.hpp>

Inheritance diagram for caches::ICachePolicy< Key >:
Inheritance graph
[legend]

Public Member Functions

virtual void Insert (const Key &key)=0
 Handle element insertion in a cache.
 
virtual void Touch (const Key &key)=0
 Handle request to the key-element in a cache.
 
virtual void Erase (const Key &key)=0
 Handle element deletion from a cache.
 
virtual const Key & ReplCandidate () const =0
 Return a key of a replacement candidate.
 

Detailed Description

template<typename Key>
class caches::ICachePolicy< Key >

Cache policy abstract base class.

Template Parameters
KeyType of a key a policy works with

Member Function Documentation

◆ Erase()

template<typename Key >
virtual void caches::ICachePolicy< Key >::Erase ( const Key &  key)
pure virtual

Handle element deletion from a cache.

Parameters
[in]keyKey that should be used by the policy

Implemented in caches::LRUCachePolicy< Key >, caches::NoCachePolicy< Key >, caches::FIFOCachePolicy< Key >, and caches::LFUCachePolicy< Key >.

◆ Insert()

template<typename Key >
virtual void caches::ICachePolicy< Key >::Insert ( const Key &  key)
pure virtual

Handle element insertion in a cache.

Parameters
[in]keyKey that should be used by the policy

Implemented in caches::NoCachePolicy< Key >, caches::FIFOCachePolicy< Key >, caches::LFUCachePolicy< Key >, and caches::LRUCachePolicy< Key >.

◆ ReplCandidate()

template<typename Key >
virtual const Key & caches::ICachePolicy< Key >::ReplCandidate ( ) const
pure virtual

Return a key of a replacement candidate.

Returns
Replacement candidate according to selected policy

Implemented in caches::NoCachePolicy< Key >, caches::FIFOCachePolicy< Key >, caches::LFUCachePolicy< Key >, and caches::LRUCachePolicy< Key >.

◆ Touch()

template<typename Key >
virtual void caches::ICachePolicy< Key >::Touch ( const Key &  key)
pure virtual

Handle request to the key-element in a cache.

Parameters
key

Implemented in caches::NoCachePolicy< Key >, caches::FIFOCachePolicy< Key >, caches::LFUCachePolicy< Key >, and caches::LRUCachePolicy< Key >.


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