* @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 */
| 50 | * function or use -e "print" with the cachesim binary |
| 51 | */ |
| 52 | cache_t *MRU_init(const common_cache_params_t ccache_params, |
| 53 | const char *cache_specific_params) { |
| 54 | cache_t *cache = cache_struct_init("MRU", ccache_params, cache_specific_params); |
| 55 | cache->cache_init = MRU_init; |
| 56 | cache->cache_free = MRU_free; |
| 57 | cache->get = MRU_get; |
| 58 | cache->find = MRU_find; |
| 59 | cache->insert = MRU_insert; |
| 60 | cache->evict = MRU_evict; |
| 61 | cache->to_evict = MRU_to_evict; |
| 62 | cache->remove = MRU_remove; |
| 63 | |
| 64 | cache->eviction_params = malloc(sizeof(MRU_params_t)); |
| 65 | MRU_params_t *params = (MRU_params_t *)cache->eviction_params; |
| 66 | params->q_head = NULL; |
| 67 | params->q_tail = NULL; |
| 68 | |
| 69 | return cache; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * free resources used by this cache |
no test coverage detected