* @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 */
| 159 | * @return the inserted object |
| 160 | */ |
| 161 | static cache_obj_t *Size_insert(cache_t *cache, const request_t *req) { |
| 162 | Size_params_t *params = cache->eviction_params; |
| 163 | |
| 164 | cache_obj_t *cached_obj = cache_insert_base(cache, req); |
| 165 | |
| 166 | pq_node_t *node = my_malloc(pq_node_t); |
| 167 | node->obj_id = req->obj_id; |
| 168 | node->pri.pri = req->obj_size; |
| 169 | pqueue_insert(params->pq, (void *)node); |
| 170 | cached_obj->Size.pq_node = node; |
| 171 | |
| 172 | return cached_obj; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * @brief find the object to be evicted |
nothing calls this directly
no test coverage detected