/** * @packageDocumentation * @module @verdigris/nitrous */ import Driver from "./driver"; export default class Cache { protected _driver: Driver; /** * Instantiate a new Cache with given driver. The `driver` is optional; if unspecified, defaults * to [[Memory]] driver. * @param {Driver} [driver] - an instance of cache driver */ constructor(driver?: Driver); /** * Gets the underlying driver for the cache. */ get driver(): Driver; /** * Gets whether the underlying driver closed the connection. */ get isClosed(): boolean; /** * Retrieve all keys. */ keys(): Promise; /** * Get whether the key exists in cache. * @param {string} key - key name */ has(key: string): Promise; /** * Get cached value at given key. * @param {string} key - key name */ get(key: string): Promise; /** * Set value to cache at given key. * @param {string} key - key name * @param {any} value - value to cache * @param {number} [ttl] - key lifetime in seconds */ set(key: string, value: any, ttl?: number): Promise; /** * Get remaining expiry time in seconds. * @param {string} key - key name */ ttl(key: string): Promise; /** * Update key with new expiry time in seconds. * @param {string} key - key name * @param {number} ttl - key lifetime in seconds */ expire(key: string, ttl: number): Promise; /** * Delete one or more keys. * @param {(string|string[])} keys - key name */ delete(keys: string | string[]): Promise; /** * Closes underlying driver. If external cache drivers (e.g. [[Redis]]) are used, this will close * the connection. Use this method to clean up and teardown. */ close(): Promise; } //# sourceMappingURL=cache.d.ts.map