|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#include <stddef.h>#include <stdint.h>#include <stdlib.h>#include <uthash.h>#include <aaruformat.h>Go to the source code of this file.
Functions | |
| void * | find_in_cache_uint64 (struct CacheHeader *cache, const uint64_t key) |
| Finds a value in the cache by uint64_t key. | |
| void | add_to_cache_uint64 (struct CacheHeader *cache, const uint64_t key, void *value) |
| Adds a value to the cache with a uint64_t key, evicting LRU if full. | |
| void | free_cache (struct CacheHeader *cache) |
| Frees all entries in the cache and clears it. | |
| void add_to_cache_uint64 | ( | struct CacheHeader * | cache, |
| const uint64_t | key, | ||
| void * | value ) |
Adds a value to the cache with a uint64_t key, evicting LRU if full.
Adds a new entry to the cache. If the cache exceeds its maximum size, evicts the least recently used (oldest insertion-order) entry.
| cache | Pointer to the cache header. |
| key | 64-bit integer key to add. |
| value | Pointer to the value to store. |
Definition at line 48 of file lru.c.
References CacheHeader::cache, CacheHeader::free_func, CacheEntry::hh, CacheEntry::key, CacheHeader::max_items, and CacheEntry::value.
Referenced by aaruf_read_sector(), and ec_recover_data_block().
| void * find_in_cache_uint64 | ( | struct CacheHeader * | cache, |
| const uint64_t | key ) |
Finds a value in the cache by uint64_t key.
Searches for a value using a native 64-bit integer key and promotes it to the front of the insertion-order list (LRU refresh) if found.
| cache | Pointer to the cache header. |
| key | 64-bit integer key to search for. |
Definition at line 24 of file lru.c.
References CacheHeader::cache, CacheEntry::hh, CacheEntry::key, and CacheEntry::value.
Referenced by aaruf_read_sector().
| void free_cache | ( | struct CacheHeader * | cache | ) |
Frees all entries in the cache and clears it.
Iterates through all cache entries, frees them, then clears the hash table. Uses the cache's free_func if set to free cached values.
| cache | Pointer to the cache header. |
Definition at line 82 of file lru.c.
References CacheHeader::cache, CacheHeader::free_func, CacheEntry::hh, and CacheEntry::value.
Referenced by aaruf_close().