@keyv/redis
Advanced tools
Comparing version 1.3.6 to 1.3.7
{ | ||
"name": "@keyv/redis", | ||
"version": "1.3.6", | ||
"version": "1.3.7", | ||
"description": "Redis storage adapter for Keyv", | ||
@@ -44,3 +44,3 @@ "main": "src/index.js", | ||
"devDependencies": { | ||
"ava": "^0.20.0", | ||
"ava": "^0.22.0", | ||
"coveralls": "^2.13.1", | ||
@@ -47,0 +47,0 @@ "delay": "^2.0.0", |
@@ -36,4 +36,14 @@ # @keyv/redis [<img width="100" align="right" src="https://rawgit.com/lukechilds/keyv/master/media/logo.svg" alt="keyv">](https://github.com/lukechilds/keyv) | ||
Or you can manually create a storage adapter instance and pass it to Keyv: | ||
```js | ||
const Keyv = require('keyv'); | ||
const KeyvRedis = require('@keyv/redis'); | ||
const redis = new KeyvRedis('redis://user:pass@localhost:6379'); | ||
const keyv = new Keyv({ store: redis }); | ||
``` | ||
## License | ||
MIT © Luke Childs |
@@ -8,8 +8,12 @@ 'use strict'; | ||
class KeyvRedis extends EventEmitter { | ||
constructor(opts) { | ||
constructor(uri, opts) { | ||
super(); | ||
this.ttlSupport = true; | ||
opts = opts || {}; | ||
if (opts.uri) { | ||
opts = Object.assign({}, { url: opts.uri }, opts); | ||
opts = Object.assign( | ||
{}, | ||
(typeof uri === 'string') ? { uri } : uri, | ||
opts | ||
); | ||
if (opts.uri && typeof opts.url === 'undefined') { | ||
opts.url = opts.uri; | ||
} | ||
@@ -16,0 +20,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
6878
69
49