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) 2011-2015 Regents of the University of California.
Provides an in-memory storage with Least Frequently Used (LFU) replacement policy.
virtual void afterAccess(InMemoryStorageEntry *entry) override
Update the entry when the entry is returned by the find() function, increment the frequency according...
virtual void beforeErase(InMemoryStorageEntry *entry) override
Update the entry or other data structures before a entry is successfully erased, erase it from the cl...
virtual bool evictItem()=0
Removes one Data packet from in-memory storage based on derived class implemented replacement policy...
Represents in-memory storage.
InMemoryStorageLfu(size_t limit=10)
Represents an in-memory storage entry.
virtual 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