/** * @module Cache */ import { type ICacheAdapter } from "../../../../cache/contracts/_module.js"; import { type IReadableContext } from "../../../../execution-context/contracts/_module.js"; import { type TimeSpan } from "../../../../time-span/implementations/_module.js"; /** * The `MemoryCacheAdapter` is used for easily faking{@link ICache | `ICache`} for testing. * * IMPORT_PATH: `"@daiso-tech/core/cache/memory-cache-adapter"` * @group Adapters */ export declare class MemoryCacheAdapter implements ICacheAdapter { private readonly map; private readonly timeoutMap; /** * You can provide an optional {@link Map | `Map`}, that will be used for storing the data. * @example * ```ts * import { MemoryCacheAdapter } from "@daiso-tech/core/cache/memory-cache-adapter"; * * const map = new Map(); * const cacheAdapter = new MemoryCacheAdapter(map); * ``` */ constructor(map?: Map); get(key: string, context: IReadableContext): Promise; add(key: string, value: TType, ttl: TimeSpan | null, context: IReadableContext): Promise; getOrAdd(key: string, valueToAdd: TType, ttl: TimeSpan | null, context: IReadableContext): Promise; private _get; getAndRemove(key: string, context: IReadableContext): Promise; private _add; put(key: string, value: TType, ttl: TimeSpan | null, context: IReadableContext): Promise; update(key: string, value: TType, _context: IReadableContext): Promise; increment(key: string, value: number, _context: IReadableContext): Promise; private _remove; removeMany(keys: Array, _context: IReadableContext): Promise; removeAll(): Promise; removeByKeyPrefix(prefix: string, _context: IReadableContext): Promise; }