NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
in-memory-storage-lru.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
23
#define NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
24
25
#include "
in-memory-storage.hpp
"
26
27
#include <boost/multi_index/member.hpp>
28
#include <boost/multi_index_container.hpp>
29
#include <boost/multi_index/sequenced_index.hpp>
30
#include <boost/multi_index/hashed_index.hpp>
31
#include <boost/multi_index/identity.hpp>
32
33
namespace
ndn
{
34
namespace
util {
35
39
class
InMemoryStorageLru
:
public
InMemoryStorage
40
{
41
public
:
42
explicit
43
InMemoryStorageLru
(
size_t
limit = 10);
44
45
virtual
46
~InMemoryStorageLru
();
47
48
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
:
53
virtual
bool
54
evictItem
();
55
59
virtual
void
60
afterAccess
(
InMemoryStorageEntry
* entry);
61
64
virtual
void
65
afterInsert
(
InMemoryStorageEntry
* entry);
66
70
virtual
void
71
beforeErase
(
InMemoryStorageEntry
* entry);
72
73
private
:
74
//multi_index_container to implement LRU
75
class
byUsedTime;
76
class
byEntity;
77
78
typedef
boost::multi_index_container<
79
InMemoryStorageEntry
*,
80
boost::multi_index::indexed_by<
81
82
// by Entry itself
83
boost::multi_index::hashed_unique<
84
boost::multi_index::tag<byEntity>,
85
boost::multi_index::identity<InMemoryStorageEntry*>
86
>,
87
88
// by last used time (LRU)
89
boost::multi_index::sequenced<
90
boost::multi_index::tag<byUsedTime>
91
>
92
93
>
94
> CleanupIndex;
95
96
CleanupIndex m_cleanupIndex;
97
};
98
99
}
// namespace util
100
}
// namespace ndn
101
102
#endif // NDN_UTIL_IN_MEMORY_STORAGE_LRU_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
in-memory-storage.hpp
ndn::util::InMemoryStorageLru::beforeErase
virtual void beforeErase(InMemoryStorageEntry *entry)
Update the entry or other data structures before a entry is successfully erased, erase it from the cl...
Definition:
in-memory-storage-lru.cpp:58
ndn::util::InMemoryStorageLru::afterAccess
virtual void afterAccess(InMemoryStorageEntry *entry)
Update the entry when the entry is returned by the find() function, update the last used time accordi...
Definition:
in-memory-storage-lru.cpp:66
ndn::util::InMemoryStorage::evictItem
virtual bool evictItem()=0
Removes one Data packet from in-memory storage based on derived class implemented replacement policy...
ndn::util::InMemoryStorage
Represents in-memory storage.
Definition:
in-memory-storage.hpp:46
ndn::util::InMemoryStorageLru::afterInsert
virtual void afterInsert(InMemoryStorageEntry *entry)
Update the entry after a entry is successfully inserted, add it to the cleanupIndex.
Definition:
in-memory-storage-lru.cpp:37
ndn::util::InMemoryStorageLru::InMemoryStorageLru
InMemoryStorageLru(size_t limit=10)
Definition:
in-memory-storage-lru.cpp:27
ndn::util::InMemoryStorageEntry
Represents an in-memory storage entry.
Definition:
in-memory-storage-entry.hpp:34
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PROTECTED
Definition:
common.hpp:42
ndn::util::InMemoryStorageLru
Provides in-memory storage employing LRU replacement policy, of which the least recently used entry w...
Definition:
in-memory-storage-lru.hpp:39
ndn::util::InMemoryStorageLru::~InMemoryStorageLru
virtual ~InMemoryStorageLru()
Definition:
in-memory-storage-lru.cpp:32
ndnSIM
ndn-cxx
src
util
in-memory-storage-lru.hpp
Generated on Tue Feb 23 2016 22:18:44 for ndnSIM by
1.8.11