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

Function Size_insert

libCacheSim/cache/eviction/Size.c:161–173  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

159 * @return the inserted object
160 */
161static 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

Callers

nothing calls this directly

Calls 2

cache_insert_baseFunction · 0.85
pqueue_insertFunction · 0.85

Tested by

no test coverage detected