Socket
Socket
Sign inDemoInstall

egg-redis

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

egg-redis - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

1

.autod.conf.js

@@ -13,2 +13,3 @@ 'use strict';

'egg-bin',
'egg-ci',
'autod',

@@ -15,0 +16,0 @@ 'eslint',

6

config/config.default.js

@@ -19,5 +19,5 @@ 'use strict';

// Cluster Redis
// client: [
// client: {
// cluster: true,
// nodes: {
// nodes: [{
// host: 'host',

@@ -34,3 +34,3 @@ // port: 'port',

// db: 'db',
// }],
// }]},

@@ -37,0 +37,0 @@ // Multi Redis

1.0.2 / 2017-07-13
==================
* fix : fix check method (#10)
* docs: add configuration details (#9)
* test: upgrade all deps (#7)
* docs:fix redis cluster doc (#6)
1.0.1 / 2017-02-21

@@ -3,0 +11,0 @@ ==================

@@ -49,3 +49,3 @@ 'use strict';

app.beforeStart(function* () {
const result = yield client.time();
const result = yield client.info();
const index = count++;

@@ -52,0 +52,0 @@ app.coreLogger.info(`[egg-redis] instance[${index}] status OK, redis currentTime: ${result[0]}`);

{
"name": "egg-redis",
"version": "1.0.1",
"version": "1.0.2",
"description": "Redis plugin for egg",

@@ -20,6 +20,7 @@ "eggPlugin": {

"autod": "^2.7.1",
"egg": "^0.12.0",
"egg-bin": "^2.0.2",
"egg-mock": "^2.3.1",
"eslint": "^3.14.1",
"egg": "^1.0.0-rc.2",
"egg-bin": "^2.2.3",
"egg-ci": "^1.3.0",
"egg-mock": "^3.0.1",
"eslint": "^3.16.1",
"eslint-config-egg": "^3.2.0",

@@ -41,3 +42,6 @@ "supertest": "^3.0.0",

"ci": {
"version": "6, 7"
"type": "travis",
"version": "6, 7",
"license": true,
"services": "redis-server"
},

@@ -44,0 +48,0 @@ "repository": {

@@ -48,2 +48,38 @@ # egg-redis

**Single Client**
```javascript
config.redis = {
client: {
port: 6379, // Redis port
host: '127.0.0.1', // Redis host
password: 'auth',
db: 0,
},
}
```
**Multi Clients**
```javascript
config.redis = {
clients: {
foo: { // instanceName. See below
port: 6379, // Redis port
host: '127.0.0.1', // Redis host
password: 'auth',
db: 0,
},
bar: {
port: 6379,
host: '127.0.0.1',
password: 'auth',
db: 1,
},
}
}
```
See [ioredis API Documentation](https://github.com/luin/ioredis/blob/master/API.md#new_Redis) for all available options.
## Usage

@@ -89,2 +125,48 @@

### Clients Depend on Redis Cluster
Before you start to use Redis Cluster, please checkout the [document](https://redis.io/topics/cluster-tutorial) first, especially confirm `cluster-enabled yes` in Redis Cluster configuration file.
In controller, you also can use `app.redis` to get the redis instance based on Redis Cluster.
```js
// app/config/config.default.js
exports.redis = {
client: {
cluster: true,
nodes: [{
host: '127.0.0.1',
port: '6379',
family: 'user',
password: 'password',
db: 'db',
}, {
host: '127.0.0.1',
port: '6380',
family: 'user',
password: 'password',
db: 'db',
}]
},
};
// app/controller/home.js
module.exports = app => {
return class HomeController extends app.Controller {
* index() {
const { ctx, app } = this;
// set
yield app.redis.set('foo', 'bar');
// get
ctx.body = yield app.redis.get('foo');
}
};
};
```
## Questions & Suggestions

@@ -91,0 +173,0 @@

Sorry, the diff of this file is not supported yet

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