diff --git a/src/caching.ts b/src/caching.ts index 1c356196..43283cae 100644 --- a/src/caching.ts +++ b/src/caching.ts @@ -74,11 +74,11 @@ export async function caching( * const result = await cache.wrap('key', () => Promise.resolve(1)); * */ - wrap: async (key: string, fn: () => Promise) => { + wrap: async (key: string, fn: () => Promise, ttl?: Ttl) => { const value = await store.get(key); if (value === undefined) { const result = await fn(); - await store.set(key, result); + await store.set(key, result, ttl); return result; } return value;