class

KemalWAF::BoundedCache(K, V)

Inherits Reference / Object

============================================================================= Bounded Cache with Memory Tracking

Generic cache that respects memory bounds Automatically evicts old entries when limit is reached

Constants

Log = ::Log.for("bounded_cache")

Constructors

new(memory_module : MemoryModule, max_entries : Int32 = 10000, entry_size_bytes : Int64 = 256_i64)
Source

Instance methods

clear

Clear all entries

Source
delete(key : K) : Bool

Delete value from cache

Source
get(key : K) : V | Nil

Get value from cache

Source
has_key?(key : K) : Bool

Check if key exists

Source
set(key : K, value : V, size_bytes : Int64 | Nil = nil) : Bool

Set value in cache (with memory tracking)

Source
size

Get cache size

Source
stats

Get cache statistics

Source

Nested types