1 | export interface LiteralObject {
|
2 | [key: string]: any;
|
3 | }
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export interface CacheStore {
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | set<T>(key: string, value: T, options?: CacheStoreSetOptions<T>): Promise<void> | void;
|
18 | |
19 |
|
20 |
|
21 |
|
22 |
|
23 | get<T>(key: string): Promise<T | undefined> | T | undefined;
|
24 | |
25 |
|
26 |
|
27 |
|
28 |
|
29 | del?(key: string): void | Promise<void>;
|
30 | }
|
31 | export interface CacheStoreSetOptions<T> {
|
32 | |
33 |
|
34 |
|
35 |
|
36 | ttl?: ((value: T) => number) | number;
|
37 | }
|
38 | /**
|
39 | * Interface defining a factory to create a cache store.
|
40 | *
|
41 | * @publicApi
|
42 | */
|
43 | export interface CacheStoreFactory {
|
44 | /**
|
45 | * Return a configured cache store.
|
46 | *
|
47 | * @param args Cache manager options received from `CacheModule.register()`
|
48 | * or `CacheModule.registerAsync()`
|
49 | */
|
50 | create(args: LiteralObject): CacheStore;
|
51 | }
|
52 | /**
|
53 | * Interface defining Cache Manager configuration options.
|
54 | *
|
55 | * @publicApi
|
56 | */
|
57 | export interface CacheManagerOptions {
|
58 | /**
|
59 | * Cache storage manager. Default is `'memory'` (in-memory store). See
|
60 | * [Different stores](https:
|
61 | * for more info.
|
62 | */
|
63 | store?: string | CacheStoreFactory | CacheStore;
|
64 | |
65 |
|
66 |
|
67 |
|
68 |
|
69 | ttl?: number;
|
70 | |
71 |
|
72 |
|
73 | max?: number;
|
74 | isCacheableValue?: (value: any) => boolean;
|
75 | }
|
76 |
|
\ | No newline at end of file |