Caches 0.1.0
LRU/LFU/FIFO Caches library
|
FIFO (First in, first out) cache policy. More...
#include <fifo_cache_policy.hpp>
Public Types | |
using | fifo_iterator = typename std::list< Key >::const_iterator |
Public Member Functions | |
void | Insert (const Key &key) override |
Handle element insertion in a cache. | |
void | Touch (const Key &key) noexcept override |
Handle request to the key-element in a cache. | |
void | Erase (const Key &key) noexcept override |
Handle element deletion from a cache. | |
const Key & | ReplCandidate () const noexcept override |
Return a key of a replacement candidate. | |
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. | |
FIFO (First in, first out) cache policy.
FIFO policy in the case of replacement removes the first added element.
That is, consider the following key adding sequence:
In the case a cache reaches its capacity, the FIFO replacement candidate policy returns firstly added element A
. To show that:
An so on, the next candidate will be B
, then C
, etc.
Key | Type of a key a policy works with |
|
inlineoverridevirtualnoexcept |
Handle element deletion from a cache.
[in] | key | Key that should be used by the policy |
Implements caches::ICachePolicy< Key >.
|
inlineoverridevirtual |
Handle element insertion in a cache.
[in] | key | Key that should be used by the policy |
Implements caches::ICachePolicy< Key >.
|
inlineoverridevirtualnoexcept |
Return a key of a replacement candidate.
Implements caches::ICachePolicy< Key >.
|
inlineoverridevirtualnoexcept |
Handle request to the key-element in a cache.
key |
Implements caches::ICachePolicy< Key >.