@keyv/redis 2.3.5 → 2.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,8 +3,9 @@
3
3
  > Redis storage adapter for Keyv
4
4
 
5
5
  [![build](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml/badge.svg)](https://github.com/jaredwray/keyv/actions/workflows/tests.yaml)
6
- [![codecov](https://codecov.io/gh/jaredwray/keyv/branch/master/graph/badge.svg?token=bRzR3RyOXZ)](https://codecov.io/gh/jaredwray/keyv)
6
+ [![codecov](https://codecov.io/gh/jaredwray/keyv/branch/main/graph/badge.svg?token=bRzR3RyOXZ)](https://codecov.io/gh/jaredwray/keyv)
7
7
  [![npm](https://img.shields.io/npm/v/@keyv/redis.svg)](https://www.npmjs.com/package/@keyv/redis)
8
+ [![npm](https://img.shields.io/npm/dm/@keyv/redis)](https://npmjs.com/package/@keyv/redis)
8
9
 
9
10
  Redis storage adapter for [Keyv](https://github.com/jaredwray/keyv).
10
11
 
@@ -55,6 +56,18 @@ const keyvRedis = new KeyvRedis(redis);
55
56
  const keyv = new Keyv({ store: keyvRedis });
56
57
  ```
57
58
 
59
+ Or reuse a previous Redis cluster:
60
+
61
+ ```js
62
+ const KeyvRedis = require('@keyv/redis');
63
+ const Redis = require('ioredis');
64
+ const Keyv = require('keyv');
65
+
66
+ const redis = new Redis.Cluster('redis://user:pass@localhost:6379');
67
+ const keyvRedis = new KeyvRedis(redis);
68
+ const keyv = new Keyv({ store: keyvRedis });
69
+ ```
70
+
58
71
  ## License
59
72
 
60
- MIT © Jared Wray & Luke Childs
73
+ MIT © Jared Wray
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyv/redis",
3
- "version": "2.3.5",
3
+ "version": "2.3.8",
4
4
  "description": "Redis storage adapter for Keyv",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -41,22 +41,22 @@
41
41
  },
42
42
  "homepage": "https://github.com/jaredwray/keyv",
43
43
  "dependencies": {
44
- "ioredis": "^5.0.4"
44
+ "ioredis": "^5.1.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@keyv/test-suite": "*",
48
- "ava": "^4.2.0",
48
+ "ava": "^4.3.0",
49
49
  "delay": "^5.0.0",
50
50
  "keyv": "*",
51
51
  "nyc": "^15.1.0",
52
52
  "requirable": "^1.0.5",
53
53
  "this": "^1.1.0",
54
- "tsd": "^0.20.0",
55
- "typescript": "^4.6.4",
56
- "xo": "^0.48.0"
54
+ "tsd": "^0.22.0",
55
+ "typescript": "^4.7.4",
56
+ "xo": "^0.50.0"
57
57
  },
58
- "tsd" : {
59
- "directory" : "test"
58
+ "tsd": {
59
+ "directory": "test"
60
60
  },
61
61
  "types": "./src/index.d.ts",
62
62
  "engines": {
package/src/index.js CHANGED
@@ -8,7 +8,7 @@ class KeyvRedis extends EventEmitter {
8
8
  this.opts = {};
9
9
  this.opts.dialect = 'redis';
10
10
 
11
- if (uri instanceof Redis || uri instanceof Redis.Cluster) {
11
+ if ((uri.options && uri.options.family) || (uri.options && uri.isCluster)) {
12
12
  this.redis = uri;
13
13
  } else {
14
14
  options = {...(typeof uri === 'string' ? {uri} : uri), ...options};
@@ -49,9 +49,14 @@ class KeyvRedis extends EventEmitter {
49
49
  return this.redis.set(key, value, 'PX', ttl);
50
50
  }
51
51
 
52
+ console.log('return in set', this.redis);
53
+
52
54
  return this.redis.set(key, value);
53
55
  })
54
- .then(() => this.redis.sadd(this._getNamespace(), key));
56
+ .then(() => {
57
+ console.log('return');
58
+ this.redis.sadd(this._getNamespace(), key);
59
+ });
55
60
  }
56
61
 
57
62
  delete(key) {