UNPKG

1.76 kBTypeScriptView Raw
1/** @module cache */
2import { ICache } from './ICache';
3/**
4 * Dummy cache implementation that doesn't do anything.
5 *
6 * It can be used in testing or in situations when cache is required
7 * but shall be disabled.
8 *
9 * @see [[ICache]]
10 */
11export declare class NullCache implements ICache {
12 /**
13 * Retrieves cached value from the cache using its key.
14 * If value is missing in the cache or expired it returns null.
15 *
16 * @param correlationId (optional) transaction id to trace execution through call chain.
17 * @param key a unique value key.
18 * @param callback callback function that receives cached value or error.
19 */
20 retrieve(correlationId: string, key: string, callback: (err: any, value: any) => void): void;
21 /**
22 * Stores value in the cache with expiration time.
23 *
24 * @param correlationId (optional) transaction id to trace execution through call chain.
25 * @param key a unique value key.
26 * @param value a value to store.
27 * @param timeout expiration timeout in milliseconds.
28 * @param callback (optional) callback function that receives an error or null for success
29 */
30 store(correlationId: string, key: string, value: any, timeout: number, callback: (err: any, value: any) => void): void;
31 /**
32 * Removes a value from the cache by its key.
33 *
34 * @param correlationId (optional) transaction id to trace execution through call chain.
35 * @param key a unique value key.
36 * @param callback (optional) callback function that receives an error or null for success
37 */
38 remove(correlationId: string, key: string, callback: (err: any) => void): void;
39}