39 LruPolicy::doAfterInsert(EntryRef i)
41 this->insertToQueue(i,
true);
46 LruPolicy::doAfterRefresh(EntryRef i)
48 this->insertToQueue(i,
false);
52 LruPolicy::doBeforeErase(EntryRef i)
54 m_queue.get<1>().erase(i);
58 LruPolicy::doBeforeUse(EntryRef i)
60 this->insertToQueue(i,
false);
64 LruPolicy::evictEntries()
66 BOOST_ASSERT(this->
getCs() !=
nullptr);
68 BOOST_ASSERT(!m_queue.empty());
76 LruPolicy::insertToQueue(EntryRef i,
bool isNewEntry)
79 auto [it, isNew] = m_queue.push_back(i);
81 BOOST_ASSERT(isNew == isNewEntry);
83 m_queue.relocate(m_queue.end(), it);
Represents a CS replacement policy.
Cs * getCs() const noexcept
Returns a pointer to the associated CS instance.
Table::const_iterator EntryRef
A reference to a CS entry.
size_t getLimit() const noexcept
Gets hard limit (in number of entries).
signal::Signal< Policy, EntryRef > beforeEvict
Signal emitted when an entry is being evicted.
Least-Recently-Used (LRU) replacement policy.
#define NFD_REGISTER_CS_POLICY(P)
Registers a CS policy.