end user facing functions init, free, get * @brief initialize a RandomTwo cache * * @param ccache_params some common cache parameters * @param cache_specific_params RandomTwo specific parameters, should be NULL */
| 45 | * @param cache_specific_params RandomTwo specific parameters, should be NULL |
| 46 | */ |
| 47 | cache_t *RandomTwo_init(const common_cache_params_t ccache_params, |
| 48 | const char *cache_specific_params) { |
| 49 | common_cache_params_t ccache_params_copy = ccache_params; |
| 50 | ccache_params_copy.hashpower = MAX(12, ccache_params_copy.hashpower - 8); |
| 51 | |
| 52 | cache_t *cache = |
| 53 | cache_struct_init("RandomTwo", ccache_params_copy, cache_specific_params); |
| 54 | cache->cache_init = RandomTwo_init; |
| 55 | cache->cache_free = RandomTwo_free; |
| 56 | cache->get = RandomTwo_get; |
| 57 | cache->find = RandomTwo_find; |
| 58 | cache->insert = RandomTwo_insert; |
| 59 | cache->to_evict = RandomTwo_to_evict; |
| 60 | cache->evict = RandomTwo_evict; |
| 61 | cache->remove = RandomTwo_remove; |
| 62 | |
| 63 | return cache; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * free resources used by this cache |
no test coverage detected