Socket
Socket
Sign inDemoInstall

@keyv/redis

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@keyv/redis - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

20

package.json
{
"name": "@keyv/redis",
"version": "2.0.0",
"version": "2.1.0",
"description": "Redis storage adapter for Keyv",

@@ -45,13 +45,13 @@ "main": "src/index.js",

"devDependencies": {
"ava": "^0.25.0",
"coveralls": "^3.0.0",
"delay": "^2.0.0",
"eslint-config-xo-lukechilds": "^1.0.0",
"ava": "^2.4.0",
"coveralls": "^3.0.7",
"delay": "^4.3.0",
"eslint-config-xo-lukechilds": "^1.0.1",
"keyv": "*",
"@keyv/test-suite": "^1.3.0",
"nyc": "^11.0.3",
"requirable": "^1.0.4",
"this": "^1.0.2",
"xo": "^0.20.1"
"@keyv/test-suite": "^1.6.11",
"nyc": "^14.1.1",
"requirable": "^1.0.5",
"this": "^1.1.0",
"xo": "^0.25.3"
}
}

@@ -39,7 +39,19 @@ # @keyv/redis [<img width="100" align="right" src="https://rawgit.com/lukechilds/keyv/master/media/logo.svg" alt="keyv">](https://github.com/lukechilds/keyv)

```js
const KeyvRedis = require('@keyv/redis');
const Keyv = require('keyv');
const keyvRedis = new KeyvRedis('redis://user:pass@localhost:6379');
const keyv = new Keyv({ store: keyvRedis });
```
Or reuse a previous Redis instance:
```js
const KeyvRedis = require('@keyv/redis');
const Redis = require('ioredis');
const Keyv = require('keyv');
const redis = new KeyvRedis('redis://user:pass@localhost:6379');
const keyv = new Keyv({ store: redis });
const redis = new Redis('redis://user:pass@localhost:6379');
const keyvRedis = new KeyvRedis(redis);
const keyv = new Keyv({ store: keyvRedis });
```

@@ -46,0 +58,0 @@

@@ -9,9 +9,10 @@ 'use strict';

super();
opts = Object.assign(
{},
(typeof uri === 'string') ? { uri } : uri,
opts
);
this.redis = new Redis(opts.uri, opts);
if (uri instanceof Redis) {
this.redis = uri;
} else {
opts = Object.assign({}, typeof uri === 'string' ? { uri } : uri, opts);
this.redis = new Redis(opts.uri, opts);
}
this.redis.on('error', err => this.emit('error', err));

@@ -30,2 +31,3 @@ }

}
return value;

@@ -39,2 +41,3 @@ });

}
return Promise.resolve()

@@ -45,2 +48,3 @@ .then(() => {

}
return this.redis.set(key, value);

@@ -47,0 +51,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc