node-cache-manager-redis-store icon indicating copy to clipboard operation
node-cache-manager-redis-store copied to clipboard

How to call .quit() or .disconnect() on redisCache.store.getClient()

Open vladwulf opened this issue 3 years ago • 1 comments

Hi,

It seems that the original redis functions that allow the client to disconnect from redis are missing, or am I missing something?

var cacheManager = require('cache-manager');
var redisStore = require('cache-manager-redis-store');
 
var redisCache = cacheManager.caching({
  store: redisStore,
  host: 'localhost', // default value
  port: 6379, // default value
  auth_pass: 'XXXXX',
  db: 0,
  ttl: 600
});
 
// listen for redis connection error event
var redisClient = redisCache.store.getClient();

In this scenario how do I call redisClient.disconnect()?

I need it in my e2e tests, otherwise the cache manager hangs...

vladwulf avatar Oct 03 '22 11:10 vladwulf

By upgrading to the latest version (v3.0.0) of this package. 😃

Previous versions required you to call redisCache.store.getClient().end(true) to interrupt the connection.

dabroek avatar Oct 15 '22 01:10 dabroek