Skip to content

Cache

Defined in: unstorage-utils.ts:128

Property Type Description Defined in
decorator CacheMethodDecorator & ((overrides) => CacheMethodDecorator) Use as decorator: @cache.decorator, or @cache.decorator({ ttl: 30 }) to override ttl, storage or prefix for one method. unstorage-utils.ts:144
storage Storage The scoped unstorage instance (for manual inspection/invalidation). unstorage-utils.ts:147
wrap <TArgs, TResult>(fn, overrides?) => (…args) => Promise<TResult> Wrap a standalone async function (any number of args). overrides replace the cache’s storage, prefix, ttl or key for this function. Without toKey, the key is <fn name>:<hash(fn source)>:<hash(args)>, so different functions never share entries. unstorage-utils.ts:135