1 namespace cachemere::policy {
3 template<
class Key,
class KeyHash,
class Value>
4 EvictionLRU<Key, KeyHash, Value>::VictimIterator::VictimIterator(
const KeyRefReverseIt& iterator) : m_iterator(iterator)
8 template<
class Key,
class KeyHash,
class Value>
const Key& EvictionLRU<Key, KeyHash, Value>::VictimIterator::operator*()
const
13 template<
class Key,
class KeyHash,
class Value>
auto EvictionLRU<Key, KeyHash, Value>::VictimIterator::operator++() -> VictimIterator&
19 template<
class Key,
class KeyHash,
class Value>
auto EvictionLRU<Key, KeyHash, Value>::VictimIterator::operator++(
int) -> VictimIterator
24 template<
class Key,
class KeyHash,
class Value>
bool EvictionLRU<Key, KeyHash, Value>::VictimIterator::operator==(
const VictimIterator& other)
const
26 return m_iterator == other.m_iterator;
29 template<
class Key,
class KeyHash,
class Value>
bool EvictionLRU<Key, KeyHash, Value>::VictimIterator::operator!=(
const VictimIterator& other)
const
31 return m_iterator != other.m_iterator;
42 assert(m_nodes.find(std::ref(key)) == m_nodes.end());
44 m_keys.emplace_front(std::ref(key));
45 m_nodes.emplace(std::ref(key), m_keys.begin());
48 template<
class Key,
class KeyHash,
class Value>
56 auto node_it = m_nodes.find(key);
57 if (node_it != m_nodes.end()) {
59 if (node_it->second != m_keys.begin()) {
60 m_keys.splice(m_keys.begin(), m_keys, node_it->second);
70 assert(!m_nodes.empty());
71 assert(!m_keys.empty());
73 if (m_keys.back().get() == key) {
77 auto it = m_nodes.find(key);
78 assert(it != m_nodes.end());