@keyv/redis 2.1.0 → 2.2.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 Luke Childs
3
+ Copyright (c) 2017-2021 Jared Wray & Luke Childs
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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-redis/actions/workflows/build.yaml/badge.svg)](https://github.com/jaredwray/keyv-redis/actions/workflows/build.yaml)
6
+ [![codecov](https://codecov.io/gh/jaredwray/keyv-redis/branch/master/graph/badge.svg?token=LVIK6r34oV)](https://codecov.io/gh/jaredwray/keyv-redis)
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,16 +1,19 @@
1
1
  {
2
2
  "name": "@keyv/redis",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
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
+ "test:services:start": "docker-compose -f ./test/redis-compose.yaml up -d",
9
+ "test:services:stop": "docker-compose -f ./test/redis-compose.yaml down -v",
10
+ "coverage": "nyc report --reporter=text-lcov > coverage.lcov"
11
11
  },
12
12
  "xo": {
13
- "extends": "xo-lukechilds"
13
+ "extends": "xo-lukechilds",
14
+ "rules": {
15
+ "unicorn/prefer-module": 0
16
+ }
14
17
  },
15
18
  "ava": {
16
19
  "require": [
@@ -19,7 +22,7 @@
19
22
  },
20
23
  "repository": {
21
24
  "type": "git",
22
- "url": "git+https://github.com/lukechilds/keyv-redis.git"
25
+ "url": "git+https://github.com/jaredwray/keyv-redis.git"
23
26
  },
24
27
  "keywords": [
25
28
  "redis",
@@ -32,25 +35,24 @@
32
35
  "cache",
33
36
  "ttl"
34
37
  ],
35
- "author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
38
+ "author": "Jared Wray <me@jaredwray.com> (http://jaredwray.com)",
36
39
  "license": "MIT",
37
40
  "bugs": {
38
- "url": "https://github.com/lukechilds/keyv-redis/issues"
41
+ "url": "https://github.com/jaredwray/keyv-redis/issues"
39
42
  },
40
- "homepage": "https://github.com/lukechilds/keyv-redis",
43
+ "homepage": "https://github.com/jaredwray/keyv-redis",
41
44
  "dependencies": {
42
- "ioredis": "~4.14.1"
45
+ "ioredis": "^4.28.0"
43
46
  },
44
47
  "devDependencies": {
45
- "ava": "^2.4.0",
46
- "coveralls": "^3.0.7",
47
- "delay": "^4.3.0",
48
+ "@keyv/test-suite": "^1.6.11",
49
+ "ava": "^3.15.0",
50
+ "delay": "^5.0.0",
48
51
  "eslint-config-xo-lukechilds": "^1.0.1",
49
52
  "keyv": "*",
50
- "@keyv/test-suite": "^1.6.11",
51
- "nyc": "^14.1.1",
53
+ "nyc": "^15.1.0",
52
54
  "requirable": "^1.0.5",
53
55
  "this": "^1.1.0",
54
- "xo": "^0.25.3"
56
+ "xo": "^0.46.4"
55
57
  }
56
58
  }
package/src/index.js CHANGED
@@ -1,20 +1,18 @@
1
- 'use strict';
2
-
3
1
  const EventEmitter = require('events');
4
2
  const Redis = require('ioredis');
5
3
 
6
4
  class KeyvRedis extends EventEmitter {
7
- constructor(uri, opts) {
5
+ constructor(uri, options) {
8
6
  super();
9
7
 
10
- if (uri instanceof Redis) {
8
+ if (uri instanceof Redis || uri instanceof Redis.Cluster) {
11
9
  this.redis = uri;
12
10
  } else {
13
- opts = Object.assign({}, typeof uri === 'string' ? { uri } : uri, opts);
14
- this.redis = new Redis(opts.uri, opts);
11
+ options = Object.assign({}, typeof uri === 'string' ? { uri } : uri, options);
12
+ this.redis = new Redis(options.uri, options);
15
13
  }
16
14
 
17
- this.redis.on('error', err => this.emit('error', err));
15
+ this.redis.on('error', error => this.emit('error', error));
18
16
  }
19
17
 
20
18
  _getNamespace() {
@@ -50,10 +48,8 @@ class KeyvRedis extends EventEmitter {
50
48
 
51
49
  delete(key) {
52
50
  return this.redis.del(key)
53
- .then(items => {
54
- return this.redis.srem(this._getNamespace(), key)
55
- .then(() => items > 0);
56
- });
51
+ .then(items => this.redis.srem(this._getNamespace(), key)
52
+ .then(() => items > 0));
57
53
  }
58
54
 
59
55
  clear() {