redis-connection-pool
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -19,6 +19,7 @@ /** | ||
import { Pool } from 'generic-pool'; | ||
interface RedisConnectionPoolConfig { | ||
export interface RedisConnectionPoolConfig { | ||
max_clients?: number; | ||
perform_checks?: boolean; | ||
} | ||
export default function redisConnectionPoolFactory(uid: string, cfg?: RedisConnectionPoolConfig, redisCfg?: RedisClientOptions): any; | ||
/** | ||
@@ -43,6 +44,6 @@ * Function: redisConnectionPoolFactory | ||
* | ||
* cfg.max_clients - (number) - Max clients alive in the connection pool at | ||
* cfg.max_clients - (number) - Max clients alive in the connection pool at | ||
* once. (default: 30) | ||
* | ||
* cfg.perform_checks - (boolean) - Perform a series of redis checks, | ||
* cfg.perform_checks - (boolean) - Perform a series of redis checks, | ||
* currently this checks to to see if | ||
@@ -58,3 +59,2 @@ * blocking push/pops can be used. | ||
*/ | ||
export default function redisConnectionPoolFactory(uid: string, cfg?: RedisConnectionPoolConfig, redisCfg?: RedisClientOptions): any; | ||
export declare class RedisConnectionPool { | ||
@@ -270,2 +270,1 @@ uid: string; | ||
} | ||
export {}; |
@@ -37,2 +37,9 @@ "use strict"; | ||
const connectionPools = new Map(); | ||
function redisConnectionPoolFactory(uid, cfg = {}, redisCfg = {}) { | ||
if (!connectionPools.has(uid)) { | ||
connectionPools.set(uid, new RedisConnectionPool(uid, cfg, redisCfg)); | ||
} | ||
return connectionPools.get(uid); | ||
} | ||
exports.default = redisConnectionPoolFactory; | ||
/** | ||
@@ -57,6 +64,6 @@ * Function: redisConnectionPoolFactory | ||
* | ||
* cfg.max_clients - (number) - Max clients alive in the connection pool at | ||
* cfg.max_clients - (number) - Max clients alive in the connection pool at | ||
* once. (default: 30) | ||
* | ||
* cfg.perform_checks - (boolean) - Perform a series of redis checks, | ||
* cfg.perform_checks - (boolean) - Perform a series of redis checks, | ||
* currently this checks to to see if | ||
@@ -72,9 +79,2 @@ * blocking push/pops can be used. | ||
*/ | ||
function redisConnectionPoolFactory(uid, cfg = {}, redisCfg = {}) { | ||
if (!connectionPools.has(uid)) { | ||
connectionPools.set(uid, new RedisConnectionPool(uid, cfg, redisCfg)); | ||
} | ||
return connectionPools.get(uid); | ||
} | ||
exports.default = redisConnectionPoolFactory; | ||
class RedisConnectionPool { | ||
@@ -81,0 +81,0 @@ constructor(uid, cfg = {}, redisCfg = {}) { |
{ | ||
"name": "redis-connection-pool", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "a redis client connection pool", | ||
@@ -36,16 +36,16 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@babel/cli": "^7.17.6", | ||
"@babel/core": "^7.17.8", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-typescript": "^7.16.7", | ||
"@types/eslint": "^8.4.1", | ||
"@types/generic-pool": "^3.1.10", | ||
"@types/node": "^17.0.23", | ||
"@types/redis": "^4.0.11", | ||
"@typescript-eslint/parser": "^5.16.0", | ||
"eslint": "^8.11.0", | ||
"@babel/cli": "7.17.6", | ||
"@babel/core": "7.17.8", | ||
"@babel/preset-env": "7.16.11", | ||
"@babel/preset-typescript": "7.16.7", | ||
"@types/eslint": "8.4.1", | ||
"@types/generic-pool": "3.1.10", | ||
"@types/node": "17.0.23", | ||
"@types/redis": "4.0.11", | ||
"@typescript-eslint/parser": "5.16.0", | ||
"eslint": "8.11.0", | ||
"jaribu": "2.2.3", | ||
"jsdoc-babel": "^0.5.0", | ||
"jsdoc-to-markdown": "^7.1.1", | ||
"typescript": "^4.6.2" | ||
"jsdoc-babel": "0.5.0", | ||
"jsdoc-to-markdown": "7.1.1", | ||
"typescript": "4.6.2" | ||
}, | ||
@@ -52,0 +52,0 @@ "repository": { |
@@ -24,3 +24,3 @@ /** | ||
interface RedisConnectionPoolConfig { | ||
export interface RedisConnectionPoolConfig { | ||
max_clients?: number; | ||
@@ -30,2 +30,9 @@ perform_checks?: boolean; | ||
export default function redisConnectionPoolFactory(uid: string, cfg: RedisConnectionPoolConfig = {}, redisCfg: RedisClientOptions = {}) { | ||
if (! connectionPools.has(uid)) { | ||
connectionPools.set(uid, new RedisConnectionPool(uid, cfg, redisCfg)); | ||
} | ||
return connectionPools.get(uid); | ||
} | ||
/** | ||
@@ -50,6 +57,6 @@ * Function: redisConnectionPoolFactory | ||
* | ||
* cfg.max_clients - (number) - Max clients alive in the connection pool at | ||
* cfg.max_clients - (number) - Max clients alive in the connection pool at | ||
* once. (default: 30) | ||
* | ||
* cfg.perform_checks - (boolean) - Perform a series of redis checks, | ||
* cfg.perform_checks - (boolean) - Perform a series of redis checks, | ||
* currently this checks to to see if | ||
@@ -65,10 +72,2 @@ * blocking push/pops can be used. | ||
*/ | ||
export default function redisConnectionPoolFactory(uid: string, cfg: RedisConnectionPoolConfig = {}, redisCfg: RedisClientOptions = {}) { | ||
if (! connectionPools.has(uid)) { | ||
connectionPools.set(uid, new RedisConnectionPool(uid, cfg, redisCfg)); | ||
} | ||
return connectionPools.get(uid); | ||
} | ||
export class RedisConnectionPool { | ||
@@ -75,0 +74,0 @@ uid: string; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
40545
1111