22 #ifndef NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
23 #define NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
27 #include <boost/multi_index/member.hpp>
28 #include <boost/multi_index_container.hpp>
29 #include <boost/multi_index/ordered_index.hpp>
30 #include <boost/multi_index/hashed_index.hpp>
31 #include <boost/multi_index/identity.hpp>
85 incrementFrequency(CleanupEntry& cleanupEntry)
87 ++cleanupEntry.frequency;
95 typedef boost::multi_index_container<
97 boost::multi_index::indexed_by<
100 boost::multi_index::hashed_unique<
101 boost::multi_index::tag<byEntity>,
102 boost::multi_index::member<CleanupEntry, InMemoryStorageEntry*, &CleanupEntry::entry>
106 boost::multi_index::ordered_non_unique<
107 boost::multi_index::tag<byFrequency>,
108 boost::multi_index::member<CleanupEntry, uint64_t, &CleanupEntry::frequency>,
115 CleanupIndex m_cleanupIndex;
121 #endif // NDN_UTIL_IN_MEMORY_STORAGE_LFU_HPP
Copyright (c) 2013-2016 Regents of the University of California.
Provides an in-memory storage with Least Frequently Used (LFU) replacement policy.
void afterAccess(InMemoryStorageEntry *entry) override
Update the entry when the entry is returned by the find() function, increment the frequency according...
bool evictItem() override
Removes one Data packet from in-memory storage based on LFU, i.e.
void beforeErase(InMemoryStorageEntry *entry) override
Update the entry or other data structures before a entry is successfully erased, erase it from the cl...
Represents in-memory storage.
InMemoryStorageLfu(size_t limit=10)
Represents an in-memory storage entry.
void afterInsert(InMemoryStorageEntry *entry) override
Update the entry after a entry is successfully inserted, add it to the cleanupIndex.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED