Data & Storage · zero-dependency · MIT

larzcache

Caching that grows with you.

In-memory LRU with TTL, save()/load() for a durable on-disk tier, and memoize() to wrap any single-argument function with a cache automatically — dependency-free, and safe to call re-entrantly (Larzscript has no shared-memory threading, so there's no data race to guard against in the first place).

larzscript pkg install cache
View on GitHub →Learn the stack

What you get

Try it

import "cache" as cache
let c = cache.new(100)
cache.set(c, "a", 1, 60)
print(cache.get(c, "a", nil))
let memo = cache.memoize(fn(n) { return n * n })
print(memo["call"](5))
print(memo["call"](5))
print(cache.stats(memo["cache"]))
Output
1
25
25
{hits: 1, misses: 0, size: 1, capacity: 1000}

Why it's in the Larz Stack

larzcache is a real Larzscript package (larzscript pkg install cache) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.