Flash Translation Layer
1.0
|
data structures and interfaces for the lru cache More...
Go to the source code of this file.
Data Structures | |
struct | lru_node |
doubly-linked list data structure More... | |
struct | lru_cache |
main LRU cache data structure More... | |
Typedefs | |
typedef int(* | lru_dealloc_fn) (const uint64_t, uintptr_t) |
deallocate the value for eviction function type. 0 means successfully evicted More... | |
Functions | |
struct lru_cache * | lru_init (const size_t capacity, lru_dealloc_fn deallocate) |
initialize the LRU cache data strcture More... | |
int | lru_put (struct lru_cache *cache, const uint64_t key, uintptr_t value) |
inser the key, value to the LRU cache More... | |
uintptr_t | lru_get (struct lru_cache *cache, const uint64_t key) |
get data from the LRU cache More... | |
int | lru_free (struct lru_cache *cache) |
deallocate the LRU cache structure More... | |
static size_t | lru_get_evict_size (struct lru_cache *cache) |
get evict size of the LRU cache More... | |
data structures and interfaces for the lru cache
typedef int(* lru_dealloc_fn) (const uint64_t, uintptr_t) |
deallocate the value for eviction function type. 0 means successfully evicted
int lru_free | ( | struct lru_cache * | cache | ) |
deallocate the LRU cache structure
cache | LRU cache data structure pointer |
uintptr_t lru_get | ( | struct lru_cache * | cache, |
const uint64_t | key | ||
) |
get data from the LRU cache
cache | LRU cache data structrue pointer |
key | key which identifies the node |
|
static |
get evict size of the LRU cache
cache | LRU cache structrue pointer |
struct lru_cache* lru_init | ( | const size_t | capacity, |
lru_dealloc_fn | deallocate | ||
) |
initialize the LRU cache data strcture
capacity | number of the entries to insert the LRU |
deallocate | deallcation function for LRU's value |
int lru_put | ( | struct lru_cache * | cache, |
const uint64_t | key, | ||
uintptr_t | value | ||
) |
inser the key, value to the LRU cache
cache | LRU cache data structure pointer |
key | key which identifies the node |
value | value which contains the data |