@adonisjs/redis
Advanced tools
Comparing version 2.0.4 to 2.0.6
@@ -0,1 +1,21 @@ | ||
<a name="2.0.6"></a> | ||
## [2.0.6](https://github.com/adonisjs/adonis-redis/compare/v2.0.5...v2.0.6) (2018-04-19) | ||
### Bug Fixes | ||
* **redis:** improve connections pool flow ([9a891c5](https://github.com/adonisjs/adonis-redis/commit/9a891c5)) | ||
<a name="2.0.5"></a> | ||
## [2.0.5](https://github.com/adonisjs/adonis-redis/compare/v2.0.4...v2.0.5) (2018-04-19) | ||
### Features | ||
* **Redis:** expose namedConnection method ([a2c527b](https://github.com/adonisjs/adonis-redis/commit/a2c527b)) | ||
<a name="2.0.4"></a> | ||
@@ -2,0 +22,0 @@ ## [2.0.4](https://github.com/adonisjs/adonis-redis/compare/v2.0.3...v2.0.4) (2018-02-07) |
{ | ||
"name": "@adonisjs/redis", | ||
"version": "2.0.4", | ||
"version": "2.0.6", | ||
"description": "AdonisJs official redis provider to make working with redis fun and simple.", | ||
@@ -12,4 +12,4 @@ "dependencies": { | ||
"devDependencies": { | ||
"@adonisjs/fold": "^4.0.5", | ||
"@adonisjs/sink": "^1.0.13", | ||
"@adonisjs/fold": "^4.0.8", | ||
"@adonisjs/sink": "^1.0.16", | ||
"coveralls": "^3.0.0", | ||
@@ -19,5 +19,5 @@ "cz-conventional-changelog": "^2.1.0", | ||
"japa-cli": "^1.0.1", | ||
"nyc": "^11.4.1", | ||
"nyc": "^11.7.1", | ||
"semver": "^5.5.0", | ||
"standard": "^10.0.3" | ||
"standard": "^11.0.1" | ||
}, | ||
@@ -24,0 +24,0 @@ "scripts": { |
@@ -78,21 +78,29 @@ 'use strict' | ||
connection = connection || this.Config.get('redis.connection') | ||
const config = this.Config.get(`redis.${connection}`) | ||
/** | ||
* Return the existing connection if exists | ||
*/ | ||
if (this.connectionPools[connection]) { | ||
return this.connectionPools[connection] | ||
return this.namedConnection(connection, config) | ||
} | ||
/** | ||
* Creates a connection using raw config and adds it to the | ||
* connection pool. | ||
* | ||
* @method namedConnection | ||
* | ||
* @param {String} name | ||
* @param {Object} config | ||
* | ||
* @return {RedisFactory} | ||
*/ | ||
namedConnection (name, config) { | ||
if (this.connectionPools[name]) { | ||
return this.connectionPools[name] | ||
} | ||
/** | ||
* Get config | ||
*/ | ||
const config = this.Config.get(`redis.${connection}`) | ||
if (!config || !_.size(config) === 0) { | ||
throw GE.RuntimeException.missingConfig(connection || 'configuration for redis', 'config/redis.js') | ||
throw GE.RuntimeException.missingConfig(name || 'configuration for redis', 'config/redis.js') | ||
} | ||
this.connectionPools[connection] = new this.Factory(config, this._isCluster(config)) | ||
return this.connectionPools[connection] | ||
this.connectionPools[name] = new this.Factory(config, this._isCluster(config)) | ||
return this.connectionPools[name] | ||
} | ||
@@ -99,0 +107,0 @@ |
@@ -355,5 +355,5 @@ 'use strict' | ||
return Promise.all(_([this.connection, this.subscriberConnection]) | ||
.filter((connection) => connection && connection.status !== 'end') | ||
.map((connection) => this._closeConnection(connection)) | ||
.value()) | ||
.filter((connection) => connection && connection.status !== 'end') | ||
.map((connection) => this._closeConnection(connection)) | ||
.value()) | ||
} | ||
@@ -360,0 +360,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
25885
638