|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#include <stdint.h>#include <uthash.h>Go to the source code of this file.
Data Structures | |
| struct | CacheEntry |
| Single hash entry in the in-memory cache. More... | |
| struct | CacheHeader |
| Cache top-level descriptor encapsulating the hash table root and capacity limit. More... | |
Functions | |
| void * | find_in_cache (struct CacheHeader *cache, const char *key) |
| Finds a value in the cache by string key. | |
| void | add_to_cache (struct CacheHeader *cache, const char *key, void *value) |
| Adds a value to the cache with a string key, pruning if necessary. | |
| void * | find_in_cache_uint64 (struct CacheHeader *cache, uint64_t key) |
| Finds a value in the cache by uint64_t key, using string conversion. | |
| void | add_to_cache_uint64 (struct CacheHeader *cache, uint64_t key, void *value) |
| Adds a value to the cache with a uint64_t key, using string conversion. | |
| void add_to_cache | ( | struct CacheHeader * | cache, |
| const char * | key, | ||
| void * | value ) |
Adds a value to the cache with a string key, pruning if necessary.
Adds a new entry to the cache. If the cache exceeds its maximum size, prunes the least recently used entry.
| cache | Pointer to the cache header. |
| key | String key to add. |
| value | Pointer to the value to store. |
Definition at line 47 of file lru.c.
References CacheHeader::cache, CacheEntry::hh, CacheEntry::key, CacheHeader::max_items, and CacheEntry::value.
Referenced by add_to_cache_uint64().
| 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, using string conversion.
Converts the uint64_t key to a string and adds the entry to the cache.
| cache | Pointer to the cache header. |
| key | 64-bit integer key to add. |
| value | Pointer to the value to store. |
Definition at line 102 of file lru.c.
References add_to_cache(), CacheEntry::key, and CacheEntry::value.
Referenced by aaruf_read_sector().
| void * find_in_cache | ( | struct CacheHeader * | cache, |
| const char * | key ) |
Finds a value in the cache by string key.
Searches for a value in the cache using a string key and moves it to the front if found.
| cache | Pointer to the cache header. |
| key | String key to search for. |
Definition at line 24 of file lru.c.
References CacheHeader::cache, CacheEntry::hh, CacheEntry::key, and CacheEntry::value.
Referenced by find_in_cache_uint64().
| void * find_in_cache_uint64 | ( | struct CacheHeader * | cache, |
| const uint64_t | key ) |
Finds a value in the cache by uint64_t key, using string conversion.
Converts the uint64_t key to a string and searches for the entry in the cache.
| cache | Pointer to the cache header. |
| key | 64-bit integer key to search for. |
Definition at line 88 of file lru.c.
References find_in_cache(), and CacheEntry::key.
Referenced by aaruf_read_sector().