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

Function Clock_find

libCacheSim/cache/eviction/Clock.c:138–151  ·  view source on GitHub ↗

* @brief check whether an object is 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 true on hit, false on miss */

Source from the content-addressed store, hash-verified

136 * @return true on hit, false on miss
137 */
138static cache_obj_t *Clock_find(cache_t *cache, const request_t *req, const bool update_cache) {
139 Clock_params_t *params = (Clock_params_t *)cache->eviction_params;
140 cache_obj_t *obj = cache_find_base(cache, req, update_cache);
141 if (obj != NULL && update_cache) {
142 if (obj->clock.freq < params->max_freq) {
143 obj->clock.freq += 1;
144 }
145#ifdef USE_BELADY
146 obj->next_access_vtime = req->next_access_vtime;
147#endif
148 }
149
150 return obj;
151}
152
153/**
154 * @brief insert an object into the cache,

Callers

nothing calls this directly

Calls 1

cache_find_baseFunction · 0.85

Tested by

no test coverage detected