@keyv/redis 2.3.7 → 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 +12 -0
- package/package.json +1 -1
- package/src/index.js +7 -2
package/README.md
CHANGED
|
@@ -56,6 +56,18 @@ const keyvRedis = new KeyvRedis(redis);
|
|
|
56
56
|
const keyv = new Keyv({ store: keyvRedis });
|
|
57
57
|
```
|
|
58
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
|
+
|
|
59
71
|
## License
|
|
60
72
|
|
|
61
73
|
MIT © Jared Wray
|
package/package.json
CHANGED
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.options && uri.options.family)) {
|
|
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(() =>
|
|
56
|
+
.then(() => {
|
|
57
|
+
console.log('return');
|
|
58
|
+
this.redis.sadd(this._getNamespace(), key);
|
|
59
|
+
});
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
delete(key) {
|