* @brief find an object in the cache * * @param cache * @param req * @param update_cache whether to update the cache, * if true, the object is promoted * and if the object is expired, it is removed from the cache * @return the object or NULL if not found */
| 132 | * @return the object or NULL if not found |
| 133 | */ |
| 134 | static cache_obj_t *Size_find(cache_t *cache, const request_t *req, |
| 135 | const bool update_cache) { |
| 136 | Size_params_t *params = cache->eviction_params; |
| 137 | cache_obj_t *cached_obj = cache_find_base(cache, req, update_cache); |
| 138 | |
| 139 | if (!update_cache) return cached_obj; |
| 140 | |
| 141 | if (cached_obj == NULL) { |
| 142 | return NULL; |
| 143 | } |
| 144 | |
| 145 | pqueue_pri_t pri = {.pri = req->obj_size}; |
| 146 | pqueue_change_priority(params->pq, pri, |
| 147 | (pq_node_t *)(cached_obj->Size.pq_node)); |
| 148 | return cached_obj; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * @brief insert an object into the cache, |
nothing calls this directly
no test coverage detected