@keyv/redis 2.3.4 → 2.3.7

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
 
@@ -57,4 +58,4 @@ const keyv = new Keyv({ store: keyvRedis });
57
58
 
58
59
  ## License
59
60
 
60
- MIT © Jared Wray & Luke Childs
61
+ MIT © Jared Wray
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyv/redis",
3
- "version": "2.3.4",
3
+ "version": "2.3.7",
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.3"
44
+ "ioredis": "^5.1.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@keyv/test-suite": "*",
48
- "ava": "^4.1.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.3",
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)) {
12
12
  this.redis = uri;
13
13
  } else {
14
14
  options = {...(typeof uri === 'string' ? {uri} : uri), ...options};
@@ -80,12 +80,10 @@ class KeyvRedis extends EventEmitter {
80
80
  }
81
81
 
82
82
  const values = await get(keys);
83
- for (const i in keys) {
84
- if (Object.prototype.hasOwnProperty.call(keys, i)) {
85
- const key = keys[i];
86
- const value = values[i];
87
- yield [key, value];
88
- }
83
+ for (const [i] of keys.entries()) {
84
+ const key = keys[i];
85
+ const value = values[i];
86
+ yield [key, value];
89
87
  }
90
88
 
91
89
  if (cursor !== '0') {
@@ -93,13 +91,17 @@ class KeyvRedis extends EventEmitter {
93
91
  }
94
92
  }
95
93
 
96
- yield * iterate(0, `${namespace ? namespace + ':' : ''}*`);
94
+ yield * iterate(0, `${namespace}:*`);
97
95
  }
98
96
 
99
97
  has(key) {
100
98
  return this.redis.exists(key)
101
99
  .then(value => value !== 0);
102
100
  }
101
+
102
+ disconnect() {
103
+ return this.redis.disconnect();
104
+ }
103
105
  }
104
106
 
105
107
  module.exports = KeyvRedis;