1 | import NodeCache = require("../../");
|
2 |
|
3 | import Options = NodeCache.Options;
|
4 | import Stats = NodeCache.Stats;
|
5 | import Callback = NodeCache.Callback;
|
6 |
|
7 | interface TypeSample {
|
8 | a: number;
|
9 | b: string;
|
10 | c: boolean;
|
11 | }
|
12 |
|
13 | {
|
14 | let options: Options;
|
15 | let cache: NodeCache;
|
16 | cache = new NodeCache();
|
17 | cache = new NodeCache(options);
|
18 | }
|
19 |
|
20 | {
|
21 | let cache: NodeCache;
|
22 | let key: string;
|
23 | let result: TypeSample | undefined;
|
24 | result = cache.get<TypeSample>(key);
|
25 | result = cache.get<TypeSample>(key);
|
26 | }
|
27 |
|
28 | {
|
29 | let cache: NodeCache;
|
30 | let keys: string[];
|
31 | let result: { [key: string]: TypeSample };
|
32 | result = cache.mget<TypeSample>(keys);
|
33 | result = cache.mget<TypeSample>(keys);
|
34 | }
|
35 |
|
36 | {
|
37 | let cache: NodeCache;
|
38 | let key: string;
|
39 | let value: TypeSample;
|
40 | let ttl: number | string;
|
41 | let result: boolean;
|
42 | result = cache.set<TypeSample>(key, value);
|
43 | result = cache.set<TypeSample>(key, value, ttl);
|
44 | result = cache.set<TypeSample>(key, value, ttl);
|
45 | result = cache.set<TypeSample>(key, value);
|
46 | }
|
47 |
|
48 | {
|
49 | let cache: NodeCache;
|
50 | let keys: string | string[];
|
51 | let result: number;
|
52 | result = cache.del(keys);
|
53 | result = cache.del(keys);
|
54 | }
|
55 |
|
56 | {
|
57 | let cache: NodeCache;
|
58 | let key: string;
|
59 | let ttl: number;
|
60 | let result: boolean;
|
61 | result = cache.ttl(key);
|
62 | result = cache.ttl(key, ttl);
|
63 | result = cache.ttl(key, ttl);
|
64 | result = cache.ttl(key);
|
65 | }
|
66 |
|
67 | {
|
68 | let cache: NodeCache;
|
69 | let result: string[];
|
70 | result = cache.keys();
|
71 | result = cache.keys();
|
72 | }
|
73 |
|
74 | {
|
75 | let cache: NodeCache;
|
76 | let key: string | number;
|
77 | let result: boolean;
|
78 | result = cache.has(key);
|
79 | result = cache.has(key);
|
80 | }
|
81 |
|
82 | {
|
83 | let cache: NodeCache;
|
84 | let result: Stats;
|
85 | result = cache.getStats();
|
86 | }
|
87 |
|
88 | {
|
89 | let cache: NodeCache;
|
90 | let key: string;
|
91 | let number: number;
|
92 | let result1: number | undefined;
|
93 | result1 = cache.getTtl(key);
|
94 | }
|
95 |
|
96 |
|
97 | {
|
98 | let cache: NodeCache;
|
99 | let result: void;
|
100 | result = cache.flushAll();
|
101 | }
|
102 |
|
103 | {
|
104 | let cache: NodeCache;
|
105 | let result: void;
|
106 | result = cache.close();
|
107 | }
|
108 |
|