You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* find an object in the cache, return the cache object if found, NULL otherwise, update_cache means whether update the cache state, e.g., moving object to the head of the queue */
/* remove an object from the cache, return true if the object is found and removed, note that this is used for user-triggered remove, eviction should use evict */
Copy file name to clipboardExpand all lines: doc/quickstart_plugin.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ Your library **must** export the following C-symbols:
61
61
|`cache_hit_hook`|`void cache_hit_hook(void *data, const request_t *req);`| A requested object is found in the cache. |
62
62
|`cache_miss_hook`|`void cache_miss_hook(void *data, const request_t *req);`| A requested object is **not** in the cache *after* insertion. |
63
63
|`cache_eviction_hook`|`obj_id_t cache_eviction_hook(void *data, const request_t *req);`| Cache is full – must return the object-ID to evict. |
64
-
|`cache_remove_hook`|`void cache_remove_hook(void *data, const obj_id_t obj_id);`| An object is explicitly removed (not necessarily due to eviction). |
64
+
|`cache_remove_hook`|`void cache_remove_hook(void *data, obj_id_t obj_id);`| An object is explicitly removed (not necessarily due to eviction). |
65
65
66
66
The opaque pointer returned by `cache_init_hook` is passed back to every other hook via the `data` parameter, letting your plugin maintain arbitrary state (linked lists, hash maps, statistics, …). For memory safety, your library can export `cache_free_hook` (`void cache_free_hook(void *data);`) to free the resources used by your cache struct according to your demands.
0 commit comments