@keyv/redis
Advanced tools
Comparing version 1.3.8 to 2.0.0
{ | ||
"name": "@keyv/redis", | ||
"version": "1.3.8", | ||
"version": "2.0.0", | ||
"description": "Redis storage adapter for Keyv", | ||
@@ -8,2 +8,4 @@ "main": "src/index.js", | ||
"test": "xo && nyc ava", | ||
"test:docker": "docker-compose up --build --abort-on-container-exit --exit-code-from test", | ||
"posttest:docker": "docker-compose down --rmi local", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls" | ||
@@ -41,8 +43,7 @@ }, | ||
"dependencies": { | ||
"pify": "3.0.0", | ||
"redis": "2.8.0" | ||
"ioredis": "~4.14.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.22.0", | ||
"coveralls": "^2.13.1", | ||
"ava": "^0.25.0", | ||
"coveralls": "^3.0.0", | ||
"delay": "^2.0.0", | ||
@@ -55,4 +56,4 @@ "eslint-config-xo-lukechilds": "^1.0.0", | ||
"this": "^1.0.2", | ||
"xo": "^0.19.0" | ||
"xo": "^0.20.1" | ||
} | ||
} |
@@ -28,3 +28,3 @@ # @keyv/redis [<img width="100" align="right" src="https://rawgit.com/lukechilds/keyv/master/media/logo.svg" alt="keyv">](https://github.com/lukechilds/keyv) | ||
Any valid [`redis.createClient()`](https://github.com/NodeRedis/node_redis#rediscreateclient) options will be passed directly through. | ||
Any valid [`Redis`](https://github.com/luin/ioredis#connect-to-redis) options will be passed directly through. | ||
@@ -31,0 +31,0 @@ e.g: |
'use strict'; | ||
const EventEmitter = require('events'); | ||
const redis = require('redis'); | ||
const pify = require('pify'); | ||
const Redis = require('ioredis'); | ||
@@ -10,3 +9,2 @@ class KeyvRedis extends EventEmitter { | ||
super(); | ||
this.ttlSupport = true; | ||
opts = Object.assign( | ||
@@ -17,14 +15,5 @@ {}, | ||
); | ||
if (opts.uri && typeof opts.url === 'undefined') { | ||
opts.url = opts.uri; | ||
} | ||
const client = redis.createClient(opts); | ||
this.redis = ['get', 'set', 'sadd', 'del', 'srem', 'smembers'].reduce((obj, method) => { | ||
obj[method] = pify(client[method].bind(client)); | ||
return obj; | ||
}, {}); | ||
client.on('error', err => this.emit('error', err)); | ||
this.redis = new Redis(opts.uri, opts); | ||
this.redis.on('error', err => this.emit('error', err)); | ||
} | ||
@@ -70,3 +59,3 @@ | ||
return this.redis.smembers(this._getNamespace()) | ||
.then(keys => this.redis.del.apply(null, keys.concat(this._getNamespace()))) | ||
.then(keys => this.redis.del(keys.concat(this._getNamespace()))) | ||
.then(() => undefined); | ||
@@ -73,0 +62,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
5152
53
+ Addedioredis@~4.14.1
+ Addedcluster-key-slot@1.1.2(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddenque@1.5.1(transitive)
+ Addedioredis@4.14.4(transitive)
+ Addedlodash.defaults@4.2.0(transitive)
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedms@2.1.3(transitive)
+ Addedredis-commands@1.5.0(transitive)
+ Addedredis-errors@1.2.0(transitive)
+ Addedredis-parser@3.0.0(transitive)
+ Addedstandard-as-callback@2.1.0(transitive)
- Removedpify@3.0.0
- Removedredis@2.8.0
- Removeddouble-ended-queue@2.1.0-0(transitive)
- Removedpify@3.0.0(transitive)
- Removedredis@2.8.0(transitive)
- Removedredis-commands@1.7.0(transitive)
- Removedredis-parser@2.6.0(transitive)