* @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 */
| 51 | * function or use -e "print" with the cachesim binary |
| 52 | */ |
| 53 | cache_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 |
no test coverage detected