model: An experimental support for LFU replacement policy (need further adjustments)
diff --git a/model/cs/content-store-impl.cc b/model/cs/content-store-impl.cc
index aa7a234..39eab27 100644
--- a/model/cs/content-store-impl.cc
+++ b/model/cs/content-store-impl.cc
@@ -23,6 +23,7 @@
#include "../../utils/trie/random-policy.h"
#include "../../utils/trie/lru-policy.h"
#include "../../utils/trie/fifo-policy.h"
+#include "../../utils/trie/lfu-policy.h"
#define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \
static struct X ## type ## templ ## RegistrationClass \
@@ -56,10 +57,17 @@
**/
template class ContentStoreImpl<fifo_policy_traits>;
+/**
+ * @brief ContentStore with Least Frequently Used (LFU) cache replacement policy
+ **/
+template class ContentStoreImpl<lfu_policy_traits>;
+
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, lru_policy_traits);
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, random_policy_traits);
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, fifo_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreImpl, lfu_policy_traits);
+
#ifdef DOXYGEN
// /**
// * \brief Content Store implementing LRU cache replacement policy
@@ -75,6 +83,11 @@
* \brief Content Store implementing Random cache replacement policy
*/
class Random : public ContentStoreImpl<random_policy_traits> { };
+
+/**
+ * \brief Content Store implementing Least Frequently Used cache replacement policy
+ */
+class Lfu : public ContentStoreImpl<lfu_policy_traits> { };
#endif
diff --git a/model/cs/content-store-with-freshness.cc b/model/cs/content-store-with-freshness.cc
index 67030d1..3691891 100644
--- a/model/cs/content-store-with-freshness.cc
+++ b/model/cs/content-store-with-freshness.cc
@@ -23,6 +23,7 @@
#include "../../utils/trie/random-policy.h"
#include "../../utils/trie/lru-policy.h"
#include "../../utils/trie/fifo-policy.h"
+#include "../../utils/trie/lfu-policy.h"
#define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \
static struct X ## type ## templ ## RegistrationClass \
@@ -56,10 +57,17 @@
**/
template class ContentStoreWithFreshness<fifo_policy_traits>;
+/**
+ * @brief ContentStore with freshness and Least Frequently Used (LFU) cache replacement policy
+ **/
+template class ContentStoreWithFreshness<lfu_policy_traits>;
+
+
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithFreshness, lru_policy_traits);
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithFreshness, random_policy_traits);
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithFreshness, fifo_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithFreshness, lfu_policy_traits);
#ifdef DOXYGEN
// /**
@@ -77,6 +85,11 @@
*/
class Freshness::Random : public ContentStoreWithFreshness<random_policy_traits> { };
+/**
+ * \brief Content Store with freshness implementing Least Frequently Used cache replacement policy
+ */
+class Freshness::Lfu : public ContentStoreWithFreshness<lfu_policy_traits> { };
+
#endif
diff --git a/model/cs/content-store-with-stats.cc b/model/cs/content-store-with-stats.cc
index 828cbb1..ad179e4 100644
--- a/model/cs/content-store-with-stats.cc
+++ b/model/cs/content-store-with-stats.cc
@@ -23,6 +23,7 @@
#include "../../utils/trie/random-policy.h"
#include "../../utils/trie/lru-policy.h"
#include "../../utils/trie/fifo-policy.h"
+#include "../../utils/trie/lfu-policy.h"
#define NS_OBJECT_ENSURE_REGISTERED_TEMPL(type, templ) \
static struct X ## type ## templ ## RegistrationClass \
@@ -56,10 +57,17 @@
**/
template class ContentStoreWithStats<fifo_policy_traits>;
+/**
+ * @brief ContentStore with stats and Least Frequently Used (LFU) cache replacement policy
+ **/
+template class ContentStoreWithStats<lfu_policy_traits>;
+
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, lru_policy_traits);
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, random_policy_traits);
NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, fifo_policy_traits);
+NS_OBJECT_ENSURE_REGISTERED_TEMPL(ContentStoreWithStats, lfu_policy_traits);
+
#ifdef DOXYGEN
// /**
@@ -77,6 +85,11 @@
*/
class Stats::Random : public ContentStoreWithStats<random_policy_traits> { };
+/**
+ * \brief Content Store with stats implementing Least Frequently Used cache replacement policy
+ */
+class Stats::Lfu : public ContentStoreWithStats<lfu_policy_traits> { };
+
#endif