Loading...
Searching...
No Matches
static_lru_hash_map_t Struct Reference

Fixed-size hash map with LRU-like eviction for bounded memory usage. More...

`#include <aaruformat/static_lru_hash_map.h>`

## Data Fields

lru_kv_pair_t * | table
| Array of key/value slots of length == size.
size_t | size
| Allocated slot capacity (FIXED at creation).
size_t | count
| Number of active (filled) entries.
size_t | max_count
| Eviction trigger threshold (size * EVICTION_LOAD_FACTOR).
size_t | target_count
| Target count after eviction (size * TARGET_LOAD_FACTOR).
uint32_t | age_counter
| Operations since last aging.
uint32_t | _padding
| Padding for alignment.

## Detailed Description

Fixed-size hash map with LRU-like eviction for bounded memory usage.

This map allocates a fixed amount of memory at creation and never grows. When the map approaches capacity (exceeds eviction threshold), it automatically evicts the least-frequently-accessed entries to make room for new insertions.

Fields:

- table: Pointer to contiguous array of lru_kv_pair_t entries.
- size: Total number of slots allocated (FIXED, never changes).
- count: Number of occupied (non-empty) slots currently in use.
- max_count: Eviction is triggered when count exceeds this value.
- target_count: After eviction, entries are removed until count <= this value.
- age_counter: Operations counter for periodic aging of access counts.

Memory usage: sizeof(static_lru_hash_map_t) + (size * sizeof(lru_kv_pair_t)) With default 24-byte entries: ~24 bytes per entry + 48 bytes for the struct.

Definition at line 97 of file static_lru_hash_map.h.

## Field Documentation

## _padding

uint32_t static_lru_hash_map_t::_padding

Padding for alignment.

Definition at line 105 of file static_lru_hash_map.h.

Referenced by static_lru_create_map().

## age_counter

uint32_t static_lru_hash_map_t::age_counter

Operations since last aging.

Definition at line 104 of file static_lru_hash_map.h.

Referenced by static_lru_age_counts(), static_lru_create_map(), and static_lru_insert_map().

## count

size_t static_lru_hash_map_t::count

Number of active (filled) entries.

Definition at line 101 of file static_lru_hash_map.h.

Referenced by evict_lru_entries(), rehash_in_place(), static_lru_create_map(), static_lru_free_slots(), static_lru_insert_map(), and static_lru_load_factor().

## max_count

size_t static_lru_hash_map_t::max_count

Eviction trigger threshold (size * EVICTION_LOAD_FACTOR).

Definition at line 102 of file static_lru_hash_map.h.

Referenced by static_lru_create_map(), and static_lru_insert_map().

## size

size_t static_lru_hash_map_t::size

Allocated slot capacity (FIXED at creation).

Definition at line 100 of file static_lru_hash_map.h.

Referenced by age_access_counts(), evict_lru_entries(), rehash_in_place(), static_lru_contains_key(), static_lru_create_map(), static_lru_free_slots(), static_lru_insert_map(), static_lru_load_factor(), and static_lru_lookup_map().

## table

lru_kv_pair_t* static_lru_hash_map_t::table

Array of key/value slots of length == size.

Definition at line 99 of file static_lru_hash_map.h.

Referenced by age_access_counts(), evict_lru_entries(), rehash_in_place(), static_lru_contains_key(), static_lru_create_map(), static_lru_free_map(), static_lru_insert_map(), and static_lru_lookup_map().

## target_count

size_t static_lru_hash_map_t::target_count

Target count after eviction (size * TARGET_LOAD_FACTOR).

Definition at line 103 of file static_lru_hash_map.h.

Referenced by evict_lru_entries(), and static_lru_create_map().

The documentation for this struct was generated from the following file:

- include/aaruformat/static_lru_hash_map.h