1 #ifndef LFU_CACHE_POLICY_HPP 2 #define LFU_CACHE_POLICY_HPP 5 #include <unordered_map> 12 template <
typename Key>
17 using lfu_iterator =
typename std::multimap<std::size_t, Key>::iterator;
25 constexpr std::size_t INIT_VAL = 1;
32 void Touch(
const Key& key)
override 37 auto updated_elem = std::make_pair(
38 elem_for_update->first + 1, elem_for_update->second);
47 void Erase(
const Key& key)
override 76 #endif // LFU_CACHE_POLICY_HPP void Erase(const Key &key) override
Definition: lfu_cache_policy.hpp:47
void Touch(const Key &key) override
Definition: lfu_cache_policy.hpp:32
Definition: lfu_cache_policy.hpp:13
const Key & ReplCandidate() const override
Definition: lfu_cache_policy.hpp:53
Definition: cache_policy.hpp:11
std::unordered_map< Key, lfu_iterator > lfu_storage
Definition: lfu_cache_policy.hpp:72
void Insert(const Key &key) override
Definition: lfu_cache_policy.hpp:23
typename std::multimap< std::size_t, Key >::iterator lfu_iterator
Definition: lfu_cache_policy.hpp:17
~LFUCachePolicy() override=default
std::multimap< std::size_t, Key > frequency_storage
Definition: lfu_cache_policy.hpp:70
void Clear() override
Definition: lfu_cache_policy.hpp:61