NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::InMemoryStorageLfu Class Reference

Provides an in-memory storage with Least Frequently Used (LFU) replacement policy. More...

#include <in-memory-storage-lfu.hpp>

Inheritance diagram for ndn::InMemoryStorageLfu:
Collaboration diagram for ndn::InMemoryStorageLfu:

Public Member Functions

 InMemoryStorageLfu (size_t limit=16)
 
 InMemoryStorageLfu (DummyIoService &ioService, 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 to LFU. More...
 
void afterInsert (InMemoryStorageEntry *entry) override
 Update the entry after a entry is successfully inserted, add it to the cleanupIndex. More...
 
void beforeErase (InMemoryStorageEntry *entry) override
 Update the entry or other data structures before a entry is successfully erased, erase it from the cleanupIndex. More...
 
- Public Member Functions inherited from ndn::InMemoryStorage
 InMemoryStorage (size_t limit=std::numeric_limits< size_t >::max())
 Create a InMemoryStorage with up to limit entries The InMemoryStorage created through this method will ignore MustBeFresh in interest processing. More...
 
 InMemoryStorage (DummyIoService &ioService, size_t limit=std::numeric_limits< size_t >::max())
 Create a InMemoryStorage with up to limit entries The InMemoryStorage created through this method will handle MustBeFresh in interest processing. More...
 
virtual ~InMemoryStorage ()
 
void insert (const Data &data, const time::milliseconds &mustBeFreshProcessingWindow=INFINITE_WINDOW)
 Inserts a Data packet. More...
 
shared_ptr< const Datafind (const Interest &interest)
 Finds the best match Data for an Interest. More...
 
shared_ptr< const Datafind (const Name &name)
 Finds the best match Data for a Name with or without the implicit digest. More...
 
void erase (const Name &prefix, const bool isPrefix=true)
 Deletes in-memory storage entry by prefix by default. More...
 
size_t getLimit () const
 
size_t size () const
 
InMemoryStorage::const_iterator begin () const
 Returns begin iterator of the in-memory storage ordering by name with digest. More...
 
InMemoryStorage::const_iterator end () const
 Returns end iterator of the in-memory storage ordering by name with digest. More...
 
virtual bool evictItem ()=0
 Removes one Data packet from in-memory storage based on derived class implemented replacement policy. More...
 
size_t getCapacity () const
 returns current capacity of in-memory storage (in packets) More...
 
bool isFull () const
 returns true if the in-memory storage uses up the current capacity, false otherwise More...
 
void eraseImpl (const Name &name)
 deletes in-memory storage entries by the Name with implicit digest. More...
 
void printCache (std::ostream &os) const
 Prints contents of the in-memory storage. More...
 
InMemoryStorageEntryselectChild (const Interest &interest, Cache::index< byFullName >::type::iterator startingPoint) const
 Implements child selector (leftmost, rightmost, undeclared). More...
 
Cache::index< byFullName >::type::iterator findNextFresh (Cache::index< byFullName >::type::iterator startingPoint) const
 Get the next iterator (include startingPoint) that satisfies MustBeFresh requirement. More...
 

Public Attributes

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED __pad0__: bool evictItem() override
 
- Public Attributes inherited from ndn::InMemoryStorage
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED __pad0__: virtual void afterAccess(InMemoryStorageEntry* entry)
 
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED __pad1__: void setCapacity(size_t nMaxPackets)
 
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad2__: Cache::iterator freeEntry(Cache::iterator it)
 

Additional Inherited Members

- Public Types inherited from ndn::InMemoryStorage
typedef boost::multi_index_container< InMemoryStorageEntry *, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< byFullName >, boost::multi_index::const_mem_fun< InMemoryStorageEntry, const Name &, &InMemoryStorageEntry::getFullName >, std::less< Name > > > > Cache
 
- Static Public Attributes inherited from ndn::InMemoryStorage
static const time::milliseconds INFINITE_WINDOW
 

Detailed Description

Provides an in-memory storage with Least Frequently Used (LFU) replacement policy.

Note
The frequency right now is usage count.
See also
https://en.wikipedia.org/w/index.php?title=Least_frequently_used&oldid=604542656

Definition at line 39 of file in-memory-storage-lfu.hpp.

Constructor & Destructor Documentation

◆ InMemoryStorageLfu() [1/2]

ndn::InMemoryStorageLfu::InMemoryStorageLfu ( size_t  limit = 16)
explicit

Definition at line 26 of file in-memory-storage-lfu.cpp.

◆ InMemoryStorageLfu() [2/2]

ndn::InMemoryStorageLfu::InMemoryStorageLfu ( DummyIoService ioService,
size_t  limit = 16 
)
explicit

Definition at line 31 of file in-memory-storage-lfu.cpp.

Member Function Documentation

◆ afterAccess()

void ndn::InMemoryStorageLfu::afterAccess ( InMemoryStorageEntry entry)
override

Update the entry when the entry is returned by the find() function, increment the frequency according to LFU.

Definition at line 68 of file in-memory-storage-lfu.cpp.

References ndn::InMemoryStorage::find().

◆ afterInsert()

void ndn::InMemoryStorageLfu::afterInsert ( InMemoryStorageEntry entry)
overridevirtual

Update the entry after a entry is successfully inserted, add it to the cleanupIndex.

Reimplemented from ndn::InMemoryStorage.

Definition at line 37 of file in-memory-storage-lfu.cpp.

References ndn::InMemoryStorage::size().

◆ beforeErase()

void ndn::InMemoryStorageLfu::beforeErase ( InMemoryStorageEntry entry)
overridevirtual

Update the entry or other data structures before a entry is successfully erased, erase it from the cleanupIndex.

Reimplemented from ndn::InMemoryStorage.

Definition at line 60 of file in-memory-storage-lfu.cpp.

References ndn::InMemoryStorage::find().

Member Data Documentation

◆ __pad0__

NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED ndn::InMemoryStorageLfu::__pad0__

Definition at line 54 of file in-memory-storage-lfu.hpp.


The documentation for this class was generated from the following files: