import { TTL, GetValue } from '../types'; declare class BaseStorageApi { private persistent; private _lootBag; private _ttl; constructor(persistent: boolean); /** * @public * @param ttlValue - number of seconds to set. applies to all * keys that don't have a key-leve ttl set. */ set timeoutInSeconds(ttlValue: TTL); /** * @public * @returns ttl in seconds which applies to all keys that don't * have a key-level ttl set. */ get timeoutInSeconds(): TTL; /** * @public * @param key - name of key * @param val - data to be stored * @param keyTimeout - optional key-level ttl in seconds. The key level * ttl overrides the global ttl if it had been set. */ put(key: string, val: any, keyTimeout?: TTL): void; /** * @public * @param key - key to access stored data * @param defaultValue - optional data if key does not exist. * @returns any or null */ get(key: string, defaultValue?: GetValue): GetValue; /** * @public * @param key */ removeKey(key: string): void; /** * @public * @param key - key used to store data * @returns true if key exists and not stale, false otherwise */ keyExists(key: string): boolean; /** * Remove all keys in storage * @public */ clear(): void; /** * @public * @returns list of keys */ keys(): string[]; /** * Remove keys that are detected to be stale. Leave other keys intact. This * method is executed only if invoked by an explicit call by the developer who * uses this library; it is not an automatic garbage collector mechanism. * @public * @returns list of keys that were deleted */ runGarbageCollector(): string[]; /** * @public * @returns true if browser's localStorage is available, false otherwise */ isLocalStorageAvailable(): boolean; /** * @private * @returns unix time */ private _getNow; /** * This method is called only when at least one of the timeouts has been set. * key timeout has priority. global this._ttl is used only if a key-level * timeout hasn't been set. * * @private * @param obj - retrieved data from storage * @returns true if key is stale, false otherwise */ private _isCacheStale; /** * @private * @param n - ostensibly a positive integer * @returns true if a positive integer, false otherwise */ private static isPositiveInteger; } export { BaseStorageApi };