libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
CacheHeader Struct Reference

Cache top-level descriptor encapsulating the hash table root and capacity limit. More...

#include <aaruformat/lru.h>

Data Fields

uint64_t max_items
 Hard limit for number of entries.
struct CacheEntrycache
 Hash root (uthash). NULL when empty.
void(* free_func )(void *)
 Optional callback to free cached values. NULL if not needed.

Detailed Description

Cache top-level descriptor encapsulating the hash table root and capacity limit.

The cache enforces an upper bound (max_items) on the number of tracked entries. On insert, the oldest entry is evicted when the limit is reached (LRU via uthash insertion order).

Fields:

  • max_items: Maximum number of entries allowed; 0 means unlimited.
  • cache: uthash root pointer; NULL when the cache is empty.
  • free_func: Optional callback to free cached values on eviction/clear.

Definition at line 41 of file lru.h.

Field Documentation

◆ cache

struct CacheEntry* CacheHeader::cache

Hash root (uthash). NULL when empty.

Definition at line 44 of file lru.h.

Referenced by aaruf_create(), aaruf_open(), add_to_cache_uint64(), find_in_cache_uint64(), and free_cache().

◆ free_func

void(* CacheHeader::free_func) (void *)

Optional callback to free cached values. NULL if not needed.

Definition at line 45 of file lru.h.

Referenced by aaruf_open(), add_to_cache_uint64(), and free_cache().

◆ max_items

uint64_t CacheHeader::max_items

Hard limit for number of entries.

Definition at line 43 of file lru.h.

Referenced by aaruf_create(), aaruf_open(), and add_to_cache_uint64().


The documentation for this struct was generated from the following file:
  • include/aaruformat/lru.h