UNPKG

1.3 kBTypeScriptView Raw
1/** @module cache */
2/**
3 * Data object to store cached values with their keys used by [[MemoryCache]]
4 */
5export declare class CacheEntry {
6 private _key;
7 private _value;
8 private _expiration;
9 /**
10 * Creates a new instance of the cache entry and assigns its values.
11 *
12 * @param key a unique key to locate the value.
13 * @param value a value to be stored.
14 * @param timeout expiration timeout in milliseconds.
15 */
16 constructor(key: string, value: any, timeout: number);
17 /**
18 * Gets the key to locate the cached value.
19 *
20 * @returns the value key.
21 */
22 getKey(): string;
23 /**
24 * Gets the cached value.
25 *
26 * @returns the value object.
27 */
28 getValue(): any;
29 /**
30 * Gets the expiration timeout.
31 *
32 * @returns the expiration timeout in milliseconds.
33 */
34 getExpiration(): number;
35 /**
36 * Sets a new value and extends its expiration.
37 *
38 * @param value a new cached value.
39 * @param timeout a expiration timeout in milliseconds.
40 */
41 setValue(value: any, timeout: number): void;
42 /**
43 * Checks if this value already expired.
44 *
45 * @returns true if the value already expires and false otherwise.
46 */
47 isExpired(): boolean;
48}