class

Altair::Support::LRUCache(K, V)

Inherits Reference < Object

Constructors

new(capacity : Int32)
Source

Instance methods

clear

Clears every entry. Used by specs and when the cache is reconfigured.

Source
get(key : K) : V | Nil

Returns the cached value for key, moving it to the most-recently used position, or nil when absent.

Source
put(key : K, value : V) : Nil

Stores value under key, evicting the least-recently-used entry when the cache is at capacity. A zero capacity stores nothing, so a disabled cache degrades to a plain lookup.

Source
size

The current number of cached entries.

Source

Nested types