UNPKG

react-dadata

Version:

React-компонент для подсказок адресов, организаций и банков с помощью сервиса DaData.ru

38 lines (37 loc) 961 B
import { HttpCache } from './abstract'; export declare class DefaultHttpCache extends HttpCache { private static sharedInstance; private _map; private _ttl; /** * Синглтон * @example * ```ts * cache.shared.get('key'); * ``` */ static get shared(): DefaultHttpCache; /** * Время жизни кеша в миллисекундах * @example * ```ts * cache.ttl = 60000; * cache.ttl = Infinity; * cache.tll = 0; * * // негативные значения игнорируются * cache.ttl = -1; * cache.ttl = Number.NEGATIVE_INFINITY; * ``` */ get ttl(): number; set ttl(ttl: number); /** * Количество элементов в кеше */ get size(): number; get<T = unknown>(key: string): T | null; set(key: string, data: unknown): this; delete(key: string): this; reset(): this; }