39 BOOST_ASSERT(m_cleanupIndex.size() <=
size());
40 CleanupEntry cleanupEntry;
41 cleanupEntry.entry = entry;
42 cleanupEntry.frequency = 0;
43 m_cleanupIndex.insert(cleanupEntry);
49 if (!m_cleanupIndex.get<byFrequency>().empty()) {
50 auto it = m_cleanupIndex.get<byFrequency>().
begin();
52 m_cleanupIndex.get<byFrequency>().
erase(it);
62 auto it = m_cleanupIndex.get<byEntity>().
find(entry);
63 if (it != m_cleanupIndex.get<byEntity>().end())
64 m_cleanupIndex.get<byEntity>().
erase(it);
70 auto it = m_cleanupIndex.get<byEntity>().
find(entry);
71 m_cleanupIndex.get<byEntity>().modify(it, &incrementFrequency);
Represents an in-memory storage entry.
InMemoryStorageLfu(size_t limit=16)
void afterAccess(InMemoryStorageEntry *entry) override
Update the entry when the entry is returned by the find() function, increment the frequency according...
void beforeErase(InMemoryStorageEntry *entry) override
Update the entry or other data structures before a entry is successfully erased, erase it from the cl...
void afterInsert(InMemoryStorageEntry *entry) override
Update the entry after a entry is successfully inserted, add it to the cleanupIndex.
bool evictItem() override
Removes one Data packet from in-memory storage based on LFU, i.e.
Represents in-memory storage.
void erase(const Name &prefix, const bool isPrefix=true)
Deletes in-memory storage entry by prefix by default.
shared_ptr< const Data > find(const Interest &interest)
Finds the best match Data for an Interest.
InMemoryStorage::const_iterator begin() const
Returns begin iterator of the in-memory storage ordering by name with digest.
void eraseImpl(const Name &name)
Deletes in-memory storage entries by the Name with implicit digest.