@lucid-softworks/async-cache
v0.1.0
Published
An async loading cache with TTL and stale-while-revalidate.
Maintainers
Readme
@lucid-softworks/async-cache
An async loading cache with concurrent-load deduplication, TTL, optional stale-while-revalidate, injected time, and explicit invalidation.
const cache = new AsyncCache<string, User>({
ttl: 60_000,
staleWhileRevalidate: 30_000,
});
const user = await cache.get(id, loadUser);Failed foreground loads reject without caching. Failed background refreshes leave the stale entry untouched.
