int lru_free(struct lru_cache *cache)
deallocate the LRU cache structure
Definition: lru.c:260
size_t capacity
Definition: lru.h:41
struct lru_node * next
Definition: lru.h:33
struct lru_node * head
Definition: lru.h:43
size_t size
Definition: lru.h:42
struct lru_cache * lru_init(const size_t capacity, lru_dealloc_fn deallocate)
initialize the LRU cache data strcture
Definition: lru.c:24
doubly-linked list data structure
Definition: lru.h:30
uintptr_t value
Definition: lru.h:32
lru_dealloc_fn deallocate
Definition: lru.h:44
main LRU cache data structure
Definition: lru.h:40
uintptr_t lru_get(struct lru_cache *cache, const uint64_t key)
get data from the LRU cache
Definition: lru.c:237
struct lru_node * prev
Definition: lru.h:34
int lru_put(struct lru_cache *cache, const uint64_t key, uintptr_t value)
inser the key, value to the LRU cache
Definition: lru.c:185
uint64_t key
Definition: lru.h:31
#define pr_debug(...)
Definition: log.h:19
int(* lru_dealloc_fn)(const uint64_t, uintptr_t)
deallocate the value for eviction function type. 0 means successfully evicted
Definition: lru.h:25
static size_t lru_get_evict_size(struct lru_cache *cache)
get evict size of the LRU cache
Definition: lru.h:63