MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / LFUCpp_init

Function LFUCpp_init

libCacheSim/cache/eviction/cpp/LFU.cpp:53–74  ·  view source on GitHub ↗

* @brief initialize the cache * * @param ccache_params some common cache parameters * @param cache_specific_params cache specific parameters, see parse_params * function or use -e "print" with the cachesim binary */

Source from the content-addressed store, hash-verified

51 * function or use -e "print" with the cachesim binary
52 */
53cache_t *LFUCpp_init(const common_cache_params_t ccache_params, const char *cache_specific_params) {
54 cache_t *cache = cache_struct_init("LFUCpp", ccache_params, cache_specific_params);
55 auto *lfu = new eviction::LFUCpp();
56 cache->eviction_params = lfu;
57
58 cache->cache_init = LFUCpp_init;
59 cache->cache_free = LFUCpp_free;
60 cache->get = LFUCpp_get;
61 cache->find = LFUCpp_find;
62 cache->insert = LFUCpp_insert;
63 cache->evict = LFUCpp_evict;
64 cache->remove = LFUCpp_remove;
65
66 if (ccache_params.consider_obj_metadata) {
67 // freq
68 cache->obj_md_size = 8;
69 } else {
70 cache->obj_md_size = 0;
71 }
72
73 return cache;
74}
75
76/**
77 * free resources used by this cache

Callers 1

create_cacheFunction · 0.85

Calls 1

cache_struct_initFunction · 0.85

Tested by

no test coverage detected