UNPKG

@vtex/api

Version:
17 lines (16 loc) 587 B
import LRU from 'lru-cache'; import { CacheLayer } from './CacheLayer'; import { FetchResult, LRUStats } from './typings'; export declare class LRUCache<K, V> implements CacheLayer<K, V> { private multilayer; private storage; private hits; private total; private disposed; constructor(options: LRU.Options<K, V>); get: (key: K) => V | void; getOrSet: (key: K, fetcher?: () => Promise<FetchResult<V>>) => Promise<V | void>; set: (key: K, value: V, maxAge?: number) => boolean; has: (key: K) => boolean; getStats: (name?: string) => LRUStats; }