caches::FIFOCachePolicy
FIFO (First in, first out) cache policy. More...
#include <fifo_cache_policy.hpp>
Inherits from caches::ICachePolicy< Key >
Public Functions
Name | |
---|---|
FIFOCachePolicy() =default | |
~FIFOCachePolicy() =default | |
virtual void | Insert(const Key & key) override Handle element insertion in a cache. |
virtual void | Touch(const Key & key) override Handle request to the key-element in a cache. |
virtual void | Erase(const Key & key) override Handle element deletion from a cache. |
virtual const Key & | ReplCandidate() const override Return a key of a replacement candidate. |
Additional inherited members
Public Functions inherited from caches::ICachePolicy< Key >
Name | |
---|---|
virtual | ~ICachePolicy() =default |
Detailed Description
template <typename Key >
class caches::FIFOCachePolicy;
FIFO (First in, first out) cache policy.
Template Parameters:
- Key Type of a key a policy works with
FIFO policy in the case of replacement removes the first added element.
That is, consider the following key adding sequence:
A -> B -> C -> ...
In the case a cache reaches its capacity, the FIFO replacement candidate policy returns firstly added element A
. To show that:
# New key: X
Initial state: A -> B -> C -> ...
Replacement candidate: A
Final state: B -> C -> ... -> X -> ...
An so on, the next candidate will be B
, then C
, etc.
Public Functions Documentation
function FIFOCachePolicy
FIFOCachePolicy() =default
function ~FIFOCachePolicy
~FIFOCachePolicy() =default
function Insert
inline virtual void Insert(
const Key & key
) override
Handle element insertion in a cache.
Parameters:
- key Key that should be used by the policy
Reimplements: caches::ICachePolicy::Insert
function Touch
inline virtual void Touch(
const Key & key
) override
Handle request to the key-element in a cache.
Parameters:
- key
Reimplements: caches::ICachePolicy::Touch
function Erase
inline virtual void Erase(
const Key & key
) override
Handle element deletion from a cache.
Parameters:
- key Key that should be used by the policy
Reimplements: caches::ICachePolicy::Erase
function ReplCandidate
inline virtual const Key & ReplCandidate() const override
Return a key of a replacement candidate.
Return: Replacement candidate according to selected policy
Reimplements: caches::ICachePolicy::ReplCandidate