UNPKG

@thermopylae/lib.cache

Version:
55 lines (54 loc) 1.36 kB
import { Undefinable } from '@thermopylae/core.declarations'; import { CacheBackend } from '../contracts/cache-backend'; import { CacheEntry } from '../contracts/commons'; /** * Backend which uses as underlying storage EcmaScript 6 Map. * It can be seen as a simple proxy over Map. * Each operation is forwarded to underlying Map instance. * * @template Key Type of the *key*. * @template Value Type of the *value*. * @template Entry Type of the cache entry. <br/> * Defaults to {@link CacheEntry}. */ declare class EsMapCacheBackend<Key, Value, Entry extends CacheEntry<Key, Value> = CacheEntry<Key, Value>> implements CacheBackend<Key, Value> { private readonly store; constructor(); /** * @inheritDoc */ get(key: Key): Undefinable<Entry>; /** * @inheritDoc */ has(key: Key): boolean; /** * @inheritDoc */ set(key: Key, value: Value): Entry; /** * @inheritDoc */ del(entry: Entry): void; /** * @inheritDoc */ clear(): void; /** * @inheritDoc */ get size(): number; /** * @inheritDoc */ [Symbol.iterator](): IterableIterator<[Key, Entry]>; /** * @inheritDoc */ keys(): IterableIterator<Key>; /** * @inheritDoc */ values(): IterableIterator<Entry>; } export { EsMapCacheBackend };