Skip to content

Commit

Permalink
Import CommonCache from @wry/caches instead of declaring locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn committed Nov 16, 2023
1 parent a087354 commit 88ed90b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Trie } from "@wry/trie";

import { StrongCache } from "@wry/caches";
import { StrongCache, CommonCache } from "@wry/caches";
import { Entry, AnyEntry } from "./entry.js";
import { parentEntrySlot } from "./context.js";

Expand Down Expand Up @@ -88,15 +88,7 @@ export type OptimisticWrapperFunction<
makeCacheKey: (...args: TKeyArgs) => TCacheKey;
};

export interface CommonCache<K,V> {
has(key: K): boolean;
get(key: K): V | undefined;
set(key: K, value: V): V;
delete(key: K): boolean;
clean(): void;
readonly size: number;
}

export { CommonCache }
export interface CommonCacheConstructor<TCacheKey, TResult, TArgs extends any[]> {
new <K extends TCacheKey, V extends Entry<TArgs, TResult>>(max?: number, dispose?: (value: V, key?: K) => void): CommonCache<K,V>;
}
Expand Down

0 comments on commit 88ed90b

Please sign in to comment.