* @brief insert an object into the cache, * update the hash table and cache metadata * this function assumes the cache has enough space * and eviction is not part of this function * * @param cache * @param req * @return the inserted object */
| 161 | * @return the inserted object |
| 162 | */ |
| 163 | static cache_obj_t *Clock_insert(cache_t *cache, const request_t *req) { |
| 164 | Clock_params_t *params = (Clock_params_t *)cache->eviction_params; |
| 165 | |
| 166 | cache_obj_t *obj = cache_insert_base(cache, req); |
| 167 | prepend_obj_to_head(¶ms->q_head, ¶ms->q_tail, obj); |
| 168 | |
| 169 | obj->clock.freq = params->init_freq; |
| 170 | #ifdef USE_BELADY |
| 171 | obj->next_access_vtime = req->next_access_vtime; |
| 172 | #endif |
| 173 | |
| 174 | return obj; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * @brief find the object to be evicted |
nothing calls this directly
no test coverage detected