class

PrismatIQ::ThreadSafeCache(K, V)

Inherits Reference < Object

Thread-safe LRU cache with optional size limit.

Note: All public methods acquire @mutex. Private methods like evict_if_needed are designed to be called ONLY from within already-synchronized contexts to avoid deadlock (Crystal's Mutex is not reentrant).

Constructors

new(max_entries : Int32 | Nil = nil)

Instance methods

[](key : K) : V | Nil
[]=(key : K, value : V) : V
clear
empty?
get_or_compute(key : K, &block : -> V) : V
has_key?(key : K) : Bool
size