Generated by
sema docfromstdlib/sema/cache.sema. Import withfrom std.cache import …. For a narrative introduction see std.cache.
std.cache — memoization (design ③).
memoize is a decorator: apply @memoize to any function to cache its result by
(callee, arguments) for the current run, over the memory store. Users can write
variants (TTL, namespacing) as ordinary decorators. memoize_disk persists across
runs under .sema/cache/ (see below).
def memoize
Section titled “def memoize”def memoize(fn, args) -> any !{memory.read, memory.write}Parameters
| name | type |
|---|---|
fn |
any |
args |
any |
Returns any
Effects !{memory.read, memory.write}
def memoize_disk
Section titled “def memoize_disk”def memoize_disk(fn, args) -> any !{fs.read, fs.write}Parameters
| name | type |
|---|---|
fn |
any |
args |
any |
Returns any
Effects !{fs.read, fs.write}