biscuit-cache-js
Version:
A lightweight, persistent, reactive browser cache with background refresh and cross-tab sync. Works like a normal cache but supercharged with sticky TTL and offline support.
9 lines (8 loc) • 533 B
TypeScript
// biscuitV2.d.ts
export interface StorageAdapter {
get(key: string): Promise<{ value: any; expiry: number; ttl: number; fetcher?: { fn: () => Promise<any>; id?: string } } | null>;
set(key: string, entry: { value: any; expiry: number; ttl: number; fetcher?: { fn: () => Promise<any>; id?: string } }): Promise<void>;
delete(key: string): Promise<void>;
clear(): Promise<void>;
getAll(): Promise<Array<{ key: string; value: any; expiry: number; ttl: number; fetcher?: { fn: () => Promise<any>; id?: string } }>>;
}