MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / Size_find

Function Size_find

libCacheSim/cache/eviction/Size.c:134–149  ·  view source on GitHub ↗

* @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 */

Source from the content-addressed store, hash-verified

132 * @return the object or NULL if not found
133 */
134static 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,

Callers

nothing calls this directly

Calls 2

cache_find_baseFunction · 0.85
pqueue_change_priorityFunction · 0.85

Tested by

no test coverage detected