@keyv/redis 2.1.3 → 2.2.3

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.
@@ -0,0 +1 @@
1
+ {"/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis/src/index.js":{"path":"/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis/src/index.js","statementMap":{"0":{"start":{"line":1,"column":21},"end":{"line":1,"column":38}},"1":{"start":{"line":2,"column":14},"end":{"line":2,"column":32}},"2":{"start":{"line":6,"column":2},"end":{"line":6,"column":10}},"3":{"start":{"line":7,"column":2},"end":{"line":7,"column":25}},"4":{"start":{"line":9,"column":2},"end":{"line":14,"column":3}},"5":{"start":{"line":10,"column":3},"end":{"line":10,"column":20}},"6":{"start":{"line":12,"column":3},"end":{"line":12,"column":81}},"7":{"start":{"line":13,"column":3},"end":{"line":13,"column":48}},"8":{"start":{"line":16,"column":2},"end":{"line":16,"column":61}},"9":{"start":{"line":16,"column":34},"end":{"line":16,"column":59}},"10":{"start":{"line":20,"column":2},"end":{"line":20,"column":39}},"11":{"start":{"line":24,"column":2},"end":{"line":31,"column":6}},"12":{"start":{"line":26,"column":4},"end":{"line":28,"column":5}},"13":{"start":{"line":27,"column":5},"end":{"line":27,"column":22}},"14":{"start":{"line":30,"column":4},"end":{"line":30,"column":17}},"15":{"start":{"line":35,"column":2},"end":{"line":37,"column":3}},"16":{"start":{"line":36,"column":3},"end":{"line":36,"column":37}},"17":{"start":{"line":39,"column":2},"end":{"line":47,"column":59}},"18":{"start":{"line":41,"column":4},"end":{"line":43,"column":5}},"19":{"start":{"line":42,"column":5},"end":{"line":42,"column":50}},"20":{"start":{"line":45,"column":4},"end":{"line":45,"column":38}},"21":{"start":{"line":47,"column":15},"end":{"line":47,"column":57}},"22":{"start":{"line":51,"column":2},"end":{"line":53,"column":28}},"23":{"start":{"line":52,"column":18},"end":{"line":53,"column":26}},"24":{"start":{"line":53,"column":16},"end":{"line":53,"column":25}},"25":{"start":{"line":57,"column":2},"end":{"line":59,"column":26}},"26":{"start":{"line":58,"column":17},"end":{"line":58,"column":66}},"27":{"start":{"line":59,"column":15},"end":{"line":59,"column":24}},"28":{"start":{"line":63,"column":0},"end":{"line":63,"column":27}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":5,"column":1},"end":{"line":5,"column":2}},"loc":{"start":{"line":5,"column":27},"end":{"line":17,"column":2}},"line":5},"1":{"name":"(anonymous_1)","decl":{"start":{"line":16,"column":25},"end":{"line":16,"column":26}},"loc":{"start":{"line":16,"column":34},"end":{"line":16,"column":59}},"line":16},"2":{"name":"(anonymous_2)","decl":{"start":{"line":19,"column":1},"end":{"line":19,"column":2}},"loc":{"start":{"line":19,"column":17},"end":{"line":21,"column":2}},"line":19},"3":{"name":"(anonymous_3)","decl":{"start":{"line":23,"column":1},"end":{"line":23,"column":2}},"loc":{"start":{"line":23,"column":10},"end":{"line":32,"column":2}},"line":23},"4":{"name":"(anonymous_4)","decl":{"start":{"line":25,"column":9},"end":{"line":25,"column":10}},"loc":{"start":{"line":25,"column":18},"end":{"line":31,"column":4}},"line":25},"5":{"name":"(anonymous_5)","decl":{"start":{"line":34,"column":1},"end":{"line":34,"column":2}},"loc":{"start":{"line":34,"column":22},"end":{"line":48,"column":2}},"line":34},"6":{"name":"(anonymous_6)","decl":{"start":{"line":40,"column":9},"end":{"line":40,"column":10}},"loc":{"start":{"line":40,"column":15},"end":{"line":46,"column":4}},"line":40},"7":{"name":"(anonymous_7)","decl":{"start":{"line":47,"column":9},"end":{"line":47,"column":10}},"loc":{"start":{"line":47,"column":15},"end":{"line":47,"column":57}},"line":47},"8":{"name":"(anonymous_8)","decl":{"start":{"line":50,"column":1},"end":{"line":50,"column":2}},"loc":{"start":{"line":50,"column":13},"end":{"line":54,"column":2}},"line":50},"9":{"name":"(anonymous_9)","decl":{"start":{"line":52,"column":9},"end":{"line":52,"column":10}},"loc":{"start":{"line":52,"column":18},"end":{"line":53,"column":26}},"line":52},"10":{"name":"(anonymous_10)","decl":{"start":{"line":53,"column":10},"end":{"line":53,"column":11}},"loc":{"start":{"line":53,"column":16},"end":{"line":53,"column":25}},"line":53},"11":{"name":"(anonymous_11)","decl":{"start":{"line":56,"column":1},"end":{"line":56,"column":2}},"loc":{"start":{"line":56,"column":9},"end":{"line":60,"column":2}},"line":56},"12":{"name":"(anonymous_12)","decl":{"start":{"line":58,"column":9},"end":{"line":58,"column":10}},"loc":{"start":{"line":58,"column":17},"end":{"line":58,"column":66}},"line":58},"13":{"name":"(anonymous_13)","decl":{"start":{"line":59,"column":9},"end":{"line":59,"column":10}},"loc":{"start":{"line":59,"column":15},"end":{"line":59,"column":24}},"line":59}},"branchMap":{"0":{"loc":{"start":{"line":9,"column":2},"end":{"line":14,"column":3}},"type":"if","locations":[{"start":{"line":9,"column":2},"end":{"line":14,"column":3}},{"start":{"line":9,"column":2},"end":{"line":14,"column":3}}],"line":9},"1":{"loc":{"start":{"line":9,"column":6},"end":{"line":9,"column":58}},"type":"binary-expr","locations":[{"start":{"line":9,"column":6},"end":{"line":9,"column":26}},{"start":{"line":9,"column":30},"end":{"line":9,"column":58}}],"line":9},"2":{"loc":{"start":{"line":12,"column":31},"end":{"line":12,"column":70}},"type":"cond-expr","locations":[{"start":{"line":12,"column":57},"end":{"line":12,"column":64}},{"start":{"line":12,"column":67},"end":{"line":12,"column":70}}],"line":12},"3":{"loc":{"start":{"line":26,"column":4},"end":{"line":28,"column":5}},"type":"if","locations":[{"start":{"line":26,"column":4},"end":{"line":28,"column":5}},{"start":{"line":26,"column":4},"end":{"line":28,"column":5}}],"line":26},"4":{"loc":{"start":{"line":35,"column":2},"end":{"line":37,"column":3}},"type":"if","locations":[{"start":{"line":35,"column":2},"end":{"line":37,"column":3}},{"start":{"line":35,"column":2},"end":{"line":37,"column":3}}],"line":35},"5":{"loc":{"start":{"line":41,"column":4},"end":{"line":43,"column":5}},"type":"if","locations":[{"start":{"line":41,"column":4},"end":{"line":43,"column":5}},{"start":{"line":41,"column":4},"end":{"line":43,"column":5}}],"line":41}},"s":{"0":1,"1":1,"2":162,"3":162,"4":162,"5":2,"6":160,"7":160,"8":162,"9":8,"10":304,"11":30,"12":30,"13":11,"14":19,"15":30,"16":1,"17":29,"18":29,"19":1,"20":28,"21":29,"22":5,"23":5,"24":5,"25":135,"26":135,"27":135,"28":1},"f":{"0":162,"1":8,"2":304,"3":30,"4":30,"5":30,"6":29,"7":29,"8":5,"9":5,"10":5,"11":135,"12":135,"13":135},"b":{"0":[2,160],"1":[162,160],"2":[158,2],"3":[11,19],"4":[1,29],"5":[1,28]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"bd8f3b81707d244584617a53dd7adf94e42c4798","contentHash":"c5e135535b639a2ad3a20d9fad0afd67bb707402a023b20709855704d5b485fa"}}
@@ -0,0 +1 @@
1
+ {"parent":"810254a5-cb5c-4b87-a408-502013ff5a42","pid":28483,"argv":["/Users/jaredwray/.nvm/versions/node/v16.13.1/bin/node","/Users/jaredwray/src/github.com/jaredwray/keyv/node_modules/ava/lib/worker/subprocess.js"],"execArgv":[],"cwd":"/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis","time":1644194105186,"ppid":28482,"coverageFilename":"/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis/.nyc_output/26233546-084d-42c8-b03f-1baeb0cafeca.json","externalId":"","uuid":"26233546-084d-42c8-b03f-1baeb0cafeca","files":["/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis/src/index.js"]}
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":28482,"argv":["/Users/jaredwray/.nvm/versions/node/v16.13.1/bin/node","/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis/node_modules/.bin/ava"],"execArgv":[],"cwd":"/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis","time":1644194104974,"ppid":28481,"coverageFilename":"/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis/.nyc_output/810254a5-cb5c-4b87-a408-502013ff5a42.json","externalId":"","uuid":"810254a5-cb5c-4b87-a408-502013ff5a42","files":[]}
@@ -0,0 +1 @@
1
+ {"processes":{"26233546-084d-42c8-b03f-1baeb0cafeca":{"parent":"810254a5-cb5c-4b87-a408-502013ff5a42","children":[]},"810254a5-cb5c-4b87-a408-502013ff5a42":{"parent":null,"children":["26233546-084d-42c8-b03f-1baeb0cafeca"]}},"files":{"/Users/jaredwray/src/github.com/jaredwray/keyv/packages/redis/src/index.js":["26233546-084d-42c8-b03f-1baeb0cafeca"]},"externalIds":{}}
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # @keyv/redis [<img width="100" align="right" src="https://rawgit.com/lukechilds/keyv/master/media/logo.svg" alt="keyv">](https://github.com/lukechilds/keyv)
1
+ # @keyv/redis [<img width="100" align="right" src="https://jaredwray.com/images/keyv.svg" alt="keyv">](https://github.com/jaredwra/keyv)
2
2
 
3
3
  > Redis storage adapter for Keyv
4
4
 
5
- [![Build Status](https://travis-ci.org/lukechilds/keyv-redis.svg?branch=master)](https://travis-ci.org/lukechilds/keyv-redis)
6
- [![Coverage Status](https://coveralls.io/repos/github/lukechilds/keyv-redis/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/keyv-redis?branch=master)
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)
7
7
  [![npm](https://img.shields.io/npm/v/@keyv/redis.svg)](https://www.npmjs.com/package/@keyv/redis)
8
8
 
9
- Redis storage adapter for [Keyv](https://github.com/lukechilds/keyv).
9
+ Redis storage adapter for [Keyv](https://github.com/jaredwray/keyv).
10
10
 
11
11
  TTL functionality is handled directly by Redis so no timestamps are stored and expired keys are cleaned up internally.
12
12
 
@@ -57,4 +57,4 @@ const keyv = new Keyv({ store: keyvRedis });
57
57
 
58
58
  ## License
59
59
 
60
- MIT © Luke Childs
60
+ MIT © Jared Wray & Luke Childs
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@keyv/redis",
3
- "version": "2.1.3",
3
+ "version": "2.2.3",
4
4
  "description": "Redis storage adapter for Keyv",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
7
  "test": "xo && nyc ava",
8
- "test:docker": "docker-compose up --build --abort-on-container-exit --exit-code-from test",
9
- "posttest:docker": "docker-compose down --rmi local",
10
- "coverage": "nyc report --reporter=text-lcov | coveralls"
8
+ "coverage": "nyc report --reporter=text-lcov > coverage.lcov",
9
+ "clean": "rm -rf node_modules && rm -rf .nyc_output && rm -rf coverage.lcov"
11
10
  },
12
11
  "xo": {
13
12
  "extends": "xo-lukechilds",
@@ -22,7 +21,7 @@
22
21
  },
23
22
  "repository": {
24
23
  "type": "git",
25
- "url": "git+https://github.com/lukechilds/keyv-redis.git"
24
+ "url": "git+https://github.com/jaredwray/keyv.git"
26
25
  },
27
26
  "keywords": [
28
27
  "redis",
@@ -35,25 +34,24 @@
35
34
  "cache",
36
35
  "ttl"
37
36
  ],
38
- "author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
37
+ "author": "Jared Wray <me@jaredwray.com> (http://jaredwray.com)",
39
38
  "license": "MIT",
40
39
  "bugs": {
41
- "url": "https://github.com/lukechilds/keyv-redis/issues"
40
+ "url": "https://github.com/jaredwray/keyv/issues"
42
41
  },
43
- "homepage": "https://github.com/lukechilds/keyv-redis",
42
+ "homepage": "https://github.com/jaredwray/keyv",
44
43
  "dependencies": {
45
- "ioredis": "~4.27.10"
44
+ "ioredis": "^4.28.5"
46
45
  },
47
46
  "devDependencies": {
48
- "@keyv/test-suite": "^1.6.11",
47
+ "@keyv/test-suite": "*",
49
48
  "ava": "^3.15.0",
50
- "coveralls": "^3.0.7",
51
49
  "delay": "^5.0.0",
52
50
  "eslint-config-xo-lukechilds": "^1.0.1",
53
51
  "keyv": "*",
54
52
  "nyc": "^15.1.0",
55
53
  "requirable": "^1.0.5",
56
54
  "this": "^1.1.0",
57
- "xo": "^0.45.0"
55
+ "xo": "^0.47.0"
58
56
  }
59
57
  }
package/src/index.js CHANGED
@@ -4,8 +4,9 @@ const Redis = require('ioredis');
4
4
  class KeyvRedis extends EventEmitter {
5
5
  constructor(uri, options) {
6
6
  super();
7
+ this.ttlSupport = true;
7
8
 
8
- if (uri instanceof Redis) {
9
+ if (uri instanceof Redis || uri instanceof Redis.Cluster) {
9
10
  this.redis = uri;
10
11
  } else {
11
12
  options = Object.assign({}, typeof uri === 'string' ? { uri } : uri, options);
package/test/test.js ADDED
@@ -0,0 +1,36 @@
1
+ const test = require('ava');
2
+ const keyvTestSuite = require('@keyv/test-suite').default;
3
+ const { keyvOfficialTests } = require('@keyv/test-suite');
4
+ const Keyv = require('keyv');
5
+ const KeyvRedis = require('this');
6
+ const Redis = require('ioredis');
7
+
8
+ const REDIS_HOST = 'localhost';
9
+ const redisURI = `redis://${REDIS_HOST}`;
10
+
11
+ keyvOfficialTests(test, Keyv, redisURI, 'redis://foo');
12
+
13
+ const store = () => new KeyvRedis(redisURI);
14
+
15
+ keyvTestSuite(test, Keyv, store);
16
+
17
+ test('reuse a redis instance', async t => {
18
+ const redis = new Redis(redisURI);
19
+ redis.foo = 'bar';
20
+ const keyv = new KeyvRedis(redis);
21
+ t.is(keyv.redis.foo, 'bar');
22
+
23
+ await keyv.set('foo', 'bar');
24
+ const value = await redis.get('foo');
25
+ t.true(value === 'bar');
26
+ t.true(await keyv.get('foo') === value);
27
+ });
28
+
29
+ test('set an undefined key', async t => {
30
+ const redis = new Redis(redisURI);
31
+ const keyv = new KeyvRedis(redis);
32
+
33
+ await keyv.set('foo2', undefined);
34
+ const result = await keyv.get('foo2');
35
+ t.true(result === undefined);
36
+ });
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2017 Luke Childs
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.