Skip to content

Commit

Permalink
fix: bad Cache definition
Browse files Browse the repository at this point in the history
  • Loading branch information
zzau13 committed Oct 19, 2022
1 parent 1ca67a4 commit 3746c39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/caching.ts
Expand Up @@ -37,7 +37,7 @@ export type Cache<S extends Store = Store> = {
get: <T>(key: string) => Promise<T | undefined>;
del: (key: string) => Promise<void>;
reset: () => Promise<void>;
wrap<T>(key: string, fn: () => Promise<T>): Promise<T>;
wrap<T>(key: string, fn: () => Promise<T>, ttl?: Ttl): Promise<T>;
store: S;
};

Expand Down
6 changes: 5 additions & 1 deletion test/stores/memory.test.ts
Expand Up @@ -59,7 +59,11 @@ describe('memory store', () => {
});

function getCachedObject() {
return cache.wrap(key, async () => ({ foo: 'bar', arr: [1, 2, 3] }));
return cache.wrap(
key,
async () => ({ foo: 'bar', arr: [1, 2, 3] }),
10 * 1000,
);
}

function getCachedString() {
Expand Down

0 comments on commit 3746c39

Please sign in to comment.