You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Client Side Caching enables Redis Servers and Clients to work together to enable a client to cache results from command sent to a server and be informed by the server when the cached result is no longer valid.
4
+
5
+
## Usage
6
+
7
+
node-redis supports two ways of instantiating client side caching support
8
+
9
+
Note: Client Side Caching is only supported with RESP3.
In this instance, the user has full control over the cache, as they have access to the cache object.
28
+
29
+
They can manually invalidate keys
30
+
31
+
```javascript
32
+
cache.invalidate(key);
33
+
```
34
+
35
+
they can clear the entire cache
36
+
g
37
+
```javascript
38
+
cache.clear();
39
+
```
40
+
41
+
as well as get cache metrics
42
+
43
+
```typescript
44
+
const hits:number=cache.cacheHits();
45
+
const misses:number=cache.cacheMisses();
46
+
```
47
+
48
+
## Pooled Caching
49
+
50
+
Similar to individual clients, node-redis also supports caching for its pooled client object, with the cache being able to be instantiated in an anonymous manner or a controllable manner.
0 commit comments