Cache key type.
Cache value type.
Get a value from the cache, constructing it via constructor on miss.
On hit: moves the entry to most-recently-used position and returns it.
On miss: calls constructor() to create the value, inserts it, and
returns it. If the cache is full, the least-recently-used entry is
evicted first.
The cached or newly constructed value.
Clear all cached entries.
Does not dispose values — the caller is responsible for cleanup (e.g. destroying GPU buffers) before calling invalidate.
Check whether eviction would be needed for a new entry.
Useful when the caller needs to perform side effects before eviction (e.g. flushing pending GPU commands before destroying an evicted buffer).
The key to check.
true if inserting key would trigger eviction of another entry.
Iterate over all cached values (for disposal).
A generic LRU (Least Recently Used) cache with bounded size.
Entries are evicted in insertion order when the cache exceeds
maxSize. Uses a Map to maintain insertion order for O(1) LRU eviction.