@graphql-mesh/cache-inmemory-lru
Version:
18 lines (17 loc) • 710 B
TypeScript
import { type HivePubSub, type KeyValueCache, type KeyValueCacheSetOptions, type MeshPubSub } from '@graphql-mesh/types';
import { DisposableSymbols } from '@whatwg-node/disposablestack';
export interface InMemoryLRUCacheOptions {
max?: number;
ttl?: number;
pubsub?: MeshPubSub | HivePubSub;
}
export default class InMemoryLRUCache<V = any> implements KeyValueCache<V>, Disposable {
private lru;
private timeouts;
constructor(options?: InMemoryLRUCacheOptions);
get(key: string): any;
set(key: string, value: any, options?: KeyValueCacheSetOptions): void;
delete(key: string): boolean;
getKeysByPrefix(prefix: string): any[];
[DisposableSymbols.dispose](): void;
}