30 #include <boost/range/adaptor/map.hpp> 31 #include <boost/range/algorithm/copy.hpp> 41 static Registry registry;
48 Registry& registry = getRegistry();
49 auto i = registry.find(policyName);
50 return i == registry.end() ? nullptr : i->second();
56 std::set<std::string> policyNames;
57 boost::copy(getRegistry() | boost::adaptors::map_keys,
58 std::inserter(policyNames, policyNames.end()));
63 : m_policyName(policyName)
71 m_limit = nMaxEntries;
78 BOOST_ASSERT(m_cs !=
nullptr);
85 BOOST_ASSERT(m_cs !=
nullptr);
92 BOOST_ASSERT(m_cs !=
nullptr);
99 BOOST_ASSERT(m_cs !=
nullptr);
virtual void evictEntries()=0
evicts zero or more entries
void afterRefresh(EntryRef i)
invoked by CS after an existing entry is refreshed by same Data
#define NFD_LOG_INIT(name)
virtual void doAfterInsert(EntryRef i)=0
invoked after a new entry is created in CS
void setLimit(size_t nMaxEntries)
sets hard limit (in number of entries)
static unique_ptr< Policy > create(const std::string &policyName)
void beforeErase(EntryRef i)
invoked by CS before an entry is erased due to management command
void afterInsert(EntryRef i)
invoked by CS after a new entry is inserted
static std::set< std::string > getPolicyNames()
virtual void doAfterRefresh(EntryRef i)=0
invoked after an existing entry is refreshed by same Data
Copyright (c) 2011-2015 Regents of the University of California.
void beforeUse(EntryRef i)
invoked by CS before an entry is used to match a lookup
Table::const_iterator EntryRef
a reference to an CS entry
virtual void doBeforeUse(EntryRef i)=0
invoked before an entry is used to match a lookup
Policy(const std::string &policyName)
virtual void doBeforeErase(EntryRef i)=0
invoked before an entry is erased due to management command