mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
gitignore modefied
https://github.com/moneroexamples/onion-monero-blockchain-explorer/pull/45
This commit is contained in:
parent
40d87bdab4
commit
468f927e8b
37 changed files with 3349 additions and 16147 deletions
53
ext/vpetrigocaches/fifo_cache_policy.hpp
Normal file
53
ext/vpetrigocaches/fifo_cache_policy.hpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
#ifndef FIFO_CACHE_POLICY_HPP
|
||||
#define FIFO_CACHE_POLICY_HPP
|
||||
|
||||
#include <list>
|
||||
#include "cache_policy.hpp"
|
||||
|
||||
namespace caches
|
||||
{
|
||||
|
||||
template <typename Key>
|
||||
class FIFOCachePolicy : public ICachePolicy<Key>
|
||||
{
|
||||
public:
|
||||
|
||||
FIFOCachePolicy() = default;
|
||||
~FIFOCachePolicy() = default;
|
||||
|
||||
void Insert(const Key& key) override
|
||||
{
|
||||
fifo_queue.emplace_front(key);
|
||||
}
|
||||
|
||||
// handle request to the key-element in a cache
|
||||
void Touch(const Key& key) override
|
||||
{
|
||||
// nothing to do here in the FIFO strategy
|
||||
}
|
||||
|
||||
// handle element deletion from a cache
|
||||
void Erase(const Key& key) override
|
||||
{
|
||||
fifo_queue.pop_back();
|
||||
}
|
||||
|
||||
// return a key of a replacement candidate
|
||||
const Key& ReplCandidate() const override
|
||||
{
|
||||
return fifo_queue.back();
|
||||
}
|
||||
|
||||
// return a key of a displacement candidate
|
||||
void Clear() override
|
||||
{
|
||||
fifo_queue.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
std::list<Key> fifo_queue;
|
||||
};
|
||||
} // namespace caches
|
||||
|
||||
#endif // FIFO_CACHE_POLICY_HPP
|
Loading…
Add table
Add a link
Reference in a new issue