* @brief this function is called by all eviction algorithms that * need to remove an object from the cache, it updates the cache metadata, * because it frees the object struct, it needs to be called at the end of * the eviction function. * * @param cache the cache * @param obj the object to be removed */
| 320 | * @param obj the object to be removed |
| 321 | */ |
| 322 | void cache_remove_obj_base(cache_t *cache, cache_obj_t *obj, bool remove_from_hashtable) { |
| 323 | DEBUG_ASSERT(cache->occupied_byte >= obj->obj_size + cache->obj_md_size); |
| 324 | cache->occupied_byte -= (obj->obj_size + cache->obj_md_size); |
| 325 | cache->n_obj -= 1; |
| 326 | if (remove_from_hashtable) { |
| 327 | hashtable_delete(cache->hashtable, obj); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * @brief print the recorded eviction age |
no outgoing calls
no test coverage detected