* @brief this function is called by all eviction algorithms in the eviction * function, 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 */
| 291 | * @param obj the object to be removed |
| 292 | */ |
| 293 | void cache_evict_base(cache_t *cache, cache_obj_t *obj, bool remove_from_hashtable) { |
| 294 | #if defined(TRACK_EVICTION_V_AGE) |
| 295 | if (cache->track_eviction_age) { |
| 296 | record_eviction_age(cache, obj, CURR_TIME(cache, req) - obj->create_time); |
| 297 | } |
| 298 | #endif |
| 299 | if (cache->prefetcher && cache->prefetcher->handle_evict) { |
| 300 | request_t *check_req = new_request(); |
| 301 | check_req->obj_id = obj->obj_id; |
| 302 | check_req->obj_size = obj->obj_size; |
| 303 | // check_req->ttl = 0; // re-add objects should be? |
| 304 | cache_remove_obj_base(cache, obj, remove_from_hashtable); |
| 305 | cache->prefetcher->handle_evict(cache, check_req); |
| 306 | my_free(sizeof(request_t), check_req); |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | cache_remove_obj_base(cache, obj, remove_from_hashtable); |
| 311 | } |
| 312 | |
| 313 | /** |
| 314 | * @brief this function is called by all eviction algorithms that |
no test coverage detected