@tirke/node-cache-manager-ioredis
Advanced tools
Comparing version 3.4.0 to 3.5.0
@@ -35,2 +35,2 @@ import { Cache, Store, Config } from 'cache-manager'; | ||
export { RedisCache, ioRedisStore }; | ||
export { type RedisCache, ioRedisStore }; |
{ | ||
"name": "@tirke/node-cache-manager-ioredis", | ||
"version": "3.4.0", | ||
"license": "MIT", | ||
"version": "3.5.0", | ||
"type": "commonjs", | ||
@@ -5,0 +6,0 @@ "repository": "https://github.com/Tirke/node-cache-manager-stores", |
@@ -30,2 +30,6 @@ [![npm version](https://badge.fury.io/js/@tirke%2Fnode-cache-manager-ioredis.svg)](https://badge.fury.io/js/@tirke%2Fnode-cache-manager-ioredis) | ||
### TTL | ||
TTL value is forwarded directly to ioredis which uses seconds as unit. | ||
### Init | ||
@@ -101,1 +105,24 @@ | ||
``` | ||
### Flush all DBs | ||
```typescript | ||
import { ioRedisStore, RedisCache } from '@tirke/node-cache-manager-ioredis' | ||
import { caching } from 'cache-manager' | ||
const redisCache: RedisCache = caching(ioRedisStore, { | ||
host: 'localhost', // default value | ||
port: 6379, // default value | ||
password: 'XXXXX', | ||
ttl: 600, | ||
}) | ||
// listen for redis connection error event | ||
const cache = redisCache.store | ||
cache.client.on('error', (error: unknown) => { | ||
// handle error here | ||
console.log(error) | ||
}) | ||
// it uses `flushall` under the hood, so it drops all DBs | ||
await redisCache.reset() | ||
``` |
13391
6
127