UNPKG

@graphql-mesh/cache-inmemory-lru

Version:
18 lines (17 loc) 670 B
import type { KeyValueCache, KeyValueCacheSetOptions, MeshPubSub } from '@graphql-mesh/types'; import { DisposableSymbols } from '@whatwg-node/disposablestack'; export interface InMemoryLRUCacheOptions { max?: number; ttl?: number; pubsub?: MeshPubSub; } 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; }