22 #ifndef NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP 23 #define NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP 27 #include <boost/multi_index_container.hpp> 28 #include <boost/multi_index/hashed_index.hpp> 29 #include <boost/multi_index/identity.hpp> 30 #include <boost/multi_index/member.hpp> 31 #include <boost/multi_index/ordered_index.hpp> 84 incrementFrequency(CleanupEntry& cleanupEntry)
86 ++cleanupEntry.frequency;
94 typedef boost::multi_index_container<
96 boost::multi_index::indexed_by<
99 boost::multi_index::hashed_unique<
100 boost::multi_index::tag<byEntity>,
101 boost::multi_index::member<CleanupEntry, InMemoryStorageEntry*, &CleanupEntry::entry>
105 boost::multi_index::ordered_non_unique<
106 boost::multi_index::tag<byFrequency>,
107 boost::multi_index::member<CleanupEntry, uint64_t, &CleanupEntry::frequency>,
114 CleanupIndex m_cleanupIndex;
119 #endif // NDN_IMS_IN_MEMORY_STORAGE_LFU_HPP Copyright (c) 2011-2015 Regents of the University of California.
Represents in-memory storage.
virtual bool evictItem()=0
Removes one Data packet from in-memory storage based on derived class implemented replacement policy.
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...
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
void afterInsert(InMemoryStorageEntry *entry) override
Update the entry after a entry is successfully inserted, add it to the cleanupIndex.
Provides an in-memory storage with Least Frequently Used (LFU) replacement policy.
Represents an in-memory storage entry.
void beforeErase(InMemoryStorageEntry *entry) override
Update the entry or other data structures before a entry is successfully erased, erase it from the cl...