/** * @packageDocumentation * @module @verdigris/nitrous */ /** * Abstract base class required for implementing a cache driver. */ export default abstract class Driver { /** * Returns whether the connection to the underlying backend is closed. */ abstract get isClosed(): boolean; /** * Returns whether the driver is connected to the underlying backend. */ abstract isConnected(): Promise; /** * Lists all keys. */ abstract keys(): Promise; /** * Gets whether the key exists in cache. * @param key {string} */ abstract has(key: string): Promise; /** * Gets the cached value at key. * @param key {string} */ abstract get(key: string): Promise; /** * Sets a value to be cached at key. * @param key {string} * @param value {any} * @param ttl {number} time-to-live in seconds */ abstract set(key: string, value: any, ttl?: number): Promise; /** * Gets the time-to-live of the key in seconds. * @param key {string} */ abstract ttl(key: string): Promise; /** * Sets the expiry duration (in seconds) for a given key. * @param key {string} * @param ttl {number} time-to-live in seconds */ abstract expire(key: string, ttl: number): Promise; /** * Delete a key. * @param key {string} */ abstract delete(keys: string | string[]): Promise; /** * Closes connection or ends cache timeouts depending on underlying driver. */ abstract close(): Promise; } //# sourceMappingURL=driver.d.ts.map