adam_core.utils.bounded_lru module

adam_core.utils.bounded_lru.bounded_lru_get(cache: OrderedDict[K, V], key: K, *, maxsize: int) V | None[source]

Get a value from a bounded LRU cache.

If present, the entry is marked as most-recently used. If maxsize <= 0, the cache is treated as disabled.

adam_core.utils.bounded_lru.bounded_lru_put(cache: OrderedDict[K, V], key: K, value: V, *, maxsize: int) None[source]

Put a value into a bounded LRU cache.

If maxsize <= 0, the cache is treated as disabled.