Std.Cache
Std.Cache — in-memory LRU + TTL cache (Layer 3 Sky source).
Types
type Cache = Cache Int
type alias CacheCfg
Values
clear : Cache k v -> Task Error ()
`clear cache` — purge every entry. Stats counters keep their
defaultCfg : CacheCfg
Default cache config: 1024 entries, no TTL, no byte cap.
get : Cache k v -> k -> Task Error (Maybe v)
`get cache key` — look up `key` in `cache`. Returns
new : CacheCfg -> Task Error (Cache k v)
`new cfg` — create a new cache. Resolves once the underlying
put : Cache k v -> k -> v -> Task Error ()
`put cache key value` — insert (or update) `key → value`. May
remove : Cache k v -> k -> Task Error ()
`remove cache key` — delete `key`. Idempotent — missing keys
size : Cache k v -> Task Error Int
`size cache` — current entry count (after lazy expiration).
stats : Cache k v -> Task Error { hits : Int , misses : Int , evictions : Int }
`stats cache` — running totals of `{ hits, misses, evictions }`
withMaxBytes : Int -> CacheCfg -> CacheCfg
Override the approximate byte cap. Reserved for v0.16+ — the
withMaxEntries : Int -> CacheCfg -> CacheCfg
Override the max number of entries. Triggers LRU eviction when
withTTL : Int -> CacheCfg -> CacheCfg
Override the per-entry TTL in milliseconds. `0` disables TTL.