@acuris/leprechaun-cache
Version:
Caching library that supports double checked caching and stale returns to avoid stampede and slow responses
12 lines (11 loc) • 503 B
TypeScript
import { CacheStore, CacheItem, Cacheable } from '../types';
export declare class MemoryCacheStore<T extends Cacheable = Cacheable> implements CacheStore<T> {
private items;
private locks;
get(key: string): Promise<CacheItem<T> | null>;
set(key: string, data: CacheItem<T>, ttl: number): Promise<boolean>;
del(key: string): Promise<boolean>;
lock(key: string, ttl: number): Promise<string | false>;
unlock(key: string, lockId: string): Promise<boolean>;
reset(): void;
}