import { CacheDriverInterface } from "../types.mjs"; //#region ../cache/src/drivers/BaseCacheEngine.d.ts /** * Base engine for the synchronous storage backends (Web Storage and the * in-memory runtime store). * * The backends themselves answer synchronously; every public method here * lifts their result into a promise (`Promise.resolve(...)`, through the * `read` / `write` / `delete` helpers) so that all drivers — including * the IndexedDB one, which cannot be synchronous — expose the exact same * async contract. No behavior changes for the Web Storage drivers: the * work still happens in the same tick, only the return type differs. */ declare class BaseCacheEngine implements CacheDriverInterface { /** * Cache storage engine */ storage: any; /** * Prefix key */ prefixKey: string; /** * Value parser */ protected _valueParser: (value: any) => any; /** * Value converter */ protected _valueConverter: (value: any) => string; /** * set value parser */ setValueParser(parser: any): this; /** * Set value converter */ setValueConverter(converter: any): this; /** * Read a raw entry from the underlying (synchronous) storage */ protected read(storageKey: string): Promise; /** * Write a raw entry into the underlying (synchronous) storage */ protected write(storageKey: string, value: any): Promise; /** * Delete a raw entry from the underlying (synchronous) storage */ protected delete(storageKey: string): Promise; /** * Get vale from storage engine */ get(key: string, defaultValue?: any): Promise; /** * Set data into storage engine */ set(key: string, value: any, expiresAfter?: number): Promise; /** * Parse stored value */ protected parseValue(value: any): any; /** * Set the mechanism to store data */ protected convertValue(value: any): string; /** * Determine whether the cache engine has a live entry for the key * * An expired entry counts as absent — and is evicted on the spot — * so `has()` and `get()` agree on every plain engine. Before 2.0.0 the * Web Storage engines reported an expired entry as present while the * runtime driver reported it as absent; consumers that branched on * `has()` then read `get()` saw a value appear and vanish. * * The encrypted engines override this: their payload is opaque until * decrypted, so they answer on presence alone. */ has(key: string): Promise; /** * Remove key from storage */ remove(key: string): Promise; /** * Get a proper key */ getKey(key: string): string; /** * Get prefix key */ getPrefixKey(): string; /** * Set prefix key */ setPrefixKey(key: string): this; /** * List the keys currently held by the storage engine * * The returned array is a snapshot: Web Storage re-indexes itself on * every removal, so iterating `storage.length` while removing entries * silently skips keys. */ protected storageKeys(): Promise; /** * List the caller-facing keys owned by this engine * * With a prefix configured, only the owned keys are listed and the * prefix is stripped so the result can be passed straight back to * `get()` / `remove()`. Without one the engine owns the whole * namespace, so everything in storage is returned. */ keys(): Promise; /** * Read every live entry owned by this engine * * Built on top of `keys()` / `get()`, so it costs one read per owned * key. The returned object has a null prototype and every key is * defined as an own property, so a stored key of `__proto__`, * `constructor` or `prototype` lands as inert data instead of reaching * a prototype setter. */ getAll(): Promise>; /** * Clear the cache storage * * Only the keys owned by this engine's prefix are removed, so several * apps sharing the same origin (and therefore the same localStorage / * sessionStorage) can clear their own namespace without destroying * each other's data. * * When no prefix is configured the engine owns the whole namespace, * so the historical behavior is kept and the entire storage is wiped. */ clear(): Promise; } //#endregion export { BaseCacheEngine }; //# sourceMappingURL=BaseCacheEngine.d.mts.map