├── .eslintrc.json ├── .github ├── release-drafter.yml └── workflows │ ├── codeql-analysis.yml │ ├── compliance.yml │ └── release-drafter.yml ├── .gitignore ├── README.md ├── docs ├── .nojekyll ├── assets │ ├── highlight.css │ ├── main.js │ ├── search.js │ ├── style.css │ ├── widgets.png │ └── widgets@2x.png ├── classes │ └── RedisConnectionPool.html ├── functions │ └── default.html ├── index.html ├── interfaces │ └── RedisConnectionPoolConfig.html └── modules.html ├── package-lock.json ├── package.json ├── renovate.json ├── src ├── index.integration.ts ├── index.test.ts └── index.ts └── tsconfig.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "env": { 4 | "browser": true, 5 | "es6": true, 6 | "node": true, 7 | "mocha": true 8 | }, 9 | "parserOptions": { 10 | "ecmaVersion": 2021, 11 | "sourceType": "module", 12 | "ecmaFeatures": { 13 | "jsx": false 14 | } 15 | }, 16 | "rules": { 17 | "comma-spacing": [2, { "before": false, "after": true }], 18 | "eqeqeq": 2, 19 | "handle-callback-err": 2, 20 | "indent": ["error", 2, { 21 | "SwitchCase": 1, 22 | "VariableDeclarator": { "var": 2, "let": 2, "const": 3 }, 23 | "FunctionDeclaration": { "parameters": "first" }, 24 | "FunctionExpression": { "parameters": "first" }, 25 | "CallExpression": { "arguments": 1 } 26 | }], 27 | "keyword-spacing": 2, 28 | "max-len": [2, { "code": 99 }], 29 | "no-eq-null": 2, 30 | "no-eval": 2, 31 | "no-tabs": 2, 32 | "no-var": 2, 33 | "semi": 2, 34 | "space-before-blocks": 2, 35 | "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}] 36 | }, 37 | "plugins": [ 38 | "security-node" 39 | ], 40 | "extends": [ 41 | "eslint:recommended", 42 | "plugin:security-node/recommended" 43 | ], 44 | "ignorePatterns": ["*.d.ts", "*.test.ts"], 45 | "overrides": [ 46 | { 47 | "files": [ 48 | "**/*.ts" 49 | ], 50 | "parser": "@typescript-eslint/parser", 51 | "parserOptions": { 52 | "project": [ 53 | "./tsconfig.json" 54 | ] 55 | }, 56 | "extends": [ 57 | "plugin:@typescript-eslint/recommended" 58 | ] 59 | } 60 | ] 61 | } 62 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | template: | 2 | ## What’s Changed 3 | 4 | $CHANGES 5 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '23 12 * * 2' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v3 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v2 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v2 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v2 72 | -------------------------------------------------------------------------------- /.github/workflows/compliance.yml: -------------------------------------------------------------------------------- 1 | name: Compliance 2 | on: pull_request 3 | jobs: 4 | lint: 5 | runs-on: ubuntu-latest 6 | strategy: 7 | matrix: 8 | node-version: [ 18 ] 9 | steps: 10 | - uses: actions/checkout@v3 11 | - name: Use Node.js ${{ matrix.node-version }} 12 | uses: actions/setup-node@v3 13 | with: 14 | node-version: ${{ matrix.node-version }} 15 | - name: Install 16 | run: npm install 17 | - name: Lint 18 | run: npm run lint 19 | test: 20 | runs-on: ubuntu-latest 21 | strategy: 22 | matrix: 23 | node-version: [ 14, 16, 18 ] 24 | steps: 25 | - uses: actions/checkout@v3 26 | - name: Use Node.js ${{ matrix.node-version }} 27 | uses: actions/setup-node@v3 28 | with: 29 | node-version: ${{ matrix.node-version }} 30 | - name: Install 31 | run: npm install 32 | - name: Build 33 | run: npm run build 34 | - name: Test 35 | run: npm run test 36 | - name: Coverage 37 | run: npm run coverage 38 | 39 | integration: 40 | runs-on: ubuntu-latest 41 | strategy: 42 | matrix: 43 | node-version: [ 14, 16, 18 ] 44 | redis-version: [ 4, 5 ] 45 | 46 | steps: 47 | - name: Git checkout 48 | uses: actions/checkout@v1 49 | 50 | - name: Use Node.js ${{ matrix.node-version }} 51 | uses: actions/setup-node@v3 52 | with: 53 | node-version: ${{ matrix.node-version }} 54 | 55 | - name: Start Redis v${{ matrix.redis-version }} 56 | uses: superchargejs/redis-github-action@1.4.0 57 | with: 58 | redis-version: ${{ matrix.redis-version }} 59 | 60 | - run: npm install 61 | - run: npm run build 62 | - run: npm run integration 63 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | - name: Release Drafter 2 | uses: release-drafter/release-drafter@v5.20.1 3 | 4 | on: 5 | push: 6 | # branches to consider in the event; optional, defaults to all 7 | branches: 8 | - master 9 | # pull_request event is required only for autolabeler 10 | pull_request: 11 | # Only following types are handled by the action, but one can default to all as well 12 | types: [opened, reopened, synchronize] 13 | # pull_request_target event is required for autolabeler to support PRs from forks 14 | # pull_request_target: 15 | # types: [opened, reopened, synchronize] 16 | 17 | permissions: 18 | contents: read 19 | 20 | jobs: 21 | update_release_draft: 22 | permissions: 23 | # write permission is required to create a github release 24 | contents: write 25 | # write permission is required for autolabeler 26 | # otherwise, read permission is required at least 27 | pull-requests: write 28 | runs-on: ubuntu-latest 29 | steps: 30 | # (Optional) GitHub Enterprise requires GHE_HOST variable set 31 | #- name: Set GHE_HOST 32 | # run: | 33 | # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV 34 | 35 | # Drafts your next Release notes as Pull Requests are merged into "master" 36 | - uses: release-drafter/release-drafter@v5 37 | # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml 38 | # with: 39 | # config-name: my-config.yml 40 | # disable-autolabeler: true 41 | env: 42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}:wq 43 | 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *~ 3 | .idea 4 | dist 5 | coverage 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | redis-connection-pool 2 | ===================== 3 | 4 | :warning: This repo is deprecated and no longer maintained. 5 | 6 | A node.js connection pool for Redis. 7 | 8 | https://silverbucket.github.io/redis-connection-pool 9 | 10 | [![Build Status](http://img.shields.io/travis/silverbucket/node-redis-connection-pool.svg?style=flat)](http://travis-ci.org/silverbucket/node-redis-connection-pool) 11 | [![license](https://img.shields.io/npm/l/redis-connection-pool.svg?style=flat)](https://npmjs.org/package/redis-connection-pool) 12 | [![downloads](http://img.shields.io/npm/dm/redis-connection-pool.svg?style=flat)](https://npmjs.org/package/redis-connection-pool) 13 | 14 | ## About 15 | 16 | A high-level redis connection pooling object. It manages 17 | a number of connections in a pool, using them as needed and keeping all aspects 18 | of releasing active connections internal to the object. 19 | 20 | ## Installation 21 | 22 | ```javascript 23 | npm install redis-connection-pool 24 | ``` 25 | 26 | ## Usage 27 | 28 | ```javascript 29 | import redisPoolFactory from 'redis-connection-pool'; 30 | const redisPool = await redisPoolFactory('myRedisPool', { 31 | max_clients: 5, // default 32 | redis: { 33 | url: 'redis://localhost:6379' 34 | } 35 | }); 36 | 37 | 38 | await redisPool.set('test-key', 'foobar'); 39 | const foo = await redisPool.get('test-key'); 40 | // returns 'foobar' 41 | ``` 42 | 43 | Or you can create a pool instance directly 44 | ```javascript 45 | import RedisConnectionPool from 'redis-connection-pool'; 46 | const redisPool = new RedisConnectionPool(); 47 | await redisPool.init(); 48 | ``` 49 | 50 | When you are done 51 | ```javascript 52 | redisPool.shutdown(); 53 | ``` 54 | 55 | ## Implemented Redis methods 56 | 57 | * **blpop** 58 | * **brpop** 59 | * **del** 60 | * **expire** 61 | * **get** 62 | * **hdel** 63 | * **hget** 64 | * **hgetall** 65 | * **hset** 66 | * **incr** 67 | * **keys** 68 | * **lpush** 69 | * **rpush** 70 | * **sendCommand** 71 | * **set** 72 | * **ttl** 73 | 74 | ## Additional methods 75 | 76 | * **init** 77 | * **shutdown** 78 | 79 | 80 | ## API Documentation 81 | For the full documentation on the `RedisConnectionPool` class, see https://silverbucket.github.io/redis-connection-pool/classes/RedisConnectionPool.html 82 | 83 | ## License 84 | 85 | [MIT](https://github.com/silverbucket/node-redis-connection-pool/blob/master/LICENSE) 86 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. -------------------------------------------------------------------------------- /docs/assets/highlight.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --light-hl-0: #001080; 3 | --dark-hl-0: #9CDCFE; 4 | --light-hl-1: #000000; 5 | --dark-hl-1: #D4D4D4; 6 | --light-hl-2: #AF00DB; 7 | --dark-hl-2: #C586C0; 8 | --light-hl-3: #A31515; 9 | --dark-hl-3: #CE9178; 10 | --light-hl-4: #0000FF; 11 | --dark-hl-4: #569CD6; 12 | --light-hl-5: #0070C1; 13 | --dark-hl-5: #4FC1FF; 14 | --light-hl-6: #795E26; 15 | --dark-hl-6: #DCDCAA; 16 | --light-hl-7: #098658; 17 | --dark-hl-7: #B5CEA8; 18 | --light-hl-8: #008000; 19 | --dark-hl-8: #6A9955; 20 | --light-code-background: #FFFFFF; 21 | --dark-code-background: #1E1E1E; 22 | } 23 | 24 | @media (prefers-color-scheme: light) { :root { 25 | --hl-0: var(--light-hl-0); 26 | --hl-1: var(--light-hl-1); 27 | --hl-2: var(--light-hl-2); 28 | --hl-3: var(--light-hl-3); 29 | --hl-4: var(--light-hl-4); 30 | --hl-5: var(--light-hl-5); 31 | --hl-6: var(--light-hl-6); 32 | --hl-7: var(--light-hl-7); 33 | --hl-8: var(--light-hl-8); 34 | --code-background: var(--light-code-background); 35 | } } 36 | 37 | @media (prefers-color-scheme: dark) { :root { 38 | --hl-0: var(--dark-hl-0); 39 | --hl-1: var(--dark-hl-1); 40 | --hl-2: var(--dark-hl-2); 41 | --hl-3: var(--dark-hl-3); 42 | --hl-4: var(--dark-hl-4); 43 | --hl-5: var(--dark-hl-5); 44 | --hl-6: var(--dark-hl-6); 45 | --hl-7: var(--dark-hl-7); 46 | --hl-8: var(--dark-hl-8); 47 | --code-background: var(--dark-code-background); 48 | } } 49 | 50 | :root[data-theme='light'] { 51 | --hl-0: var(--light-hl-0); 52 | --hl-1: var(--light-hl-1); 53 | --hl-2: var(--light-hl-2); 54 | --hl-3: var(--light-hl-3); 55 | --hl-4: var(--light-hl-4); 56 | --hl-5: var(--light-hl-5); 57 | --hl-6: var(--light-hl-6); 58 | --hl-7: var(--light-hl-7); 59 | --hl-8: var(--light-hl-8); 60 | --code-background: var(--light-code-background); 61 | } 62 | 63 | :root[data-theme='dark'] { 64 | --hl-0: var(--dark-hl-0); 65 | --hl-1: var(--dark-hl-1); 66 | --hl-2: var(--dark-hl-2); 67 | --hl-3: var(--dark-hl-3); 68 | --hl-4: var(--dark-hl-4); 69 | --hl-5: var(--dark-hl-5); 70 | --hl-6: var(--dark-hl-6); 71 | --hl-7: var(--dark-hl-7); 72 | --hl-8: var(--dark-hl-8); 73 | --code-background: var(--dark-code-background); 74 | } 75 | 76 | .hl-0 { color: var(--hl-0); } 77 | .hl-1 { color: var(--hl-1); } 78 | .hl-2 { color: var(--hl-2); } 79 | .hl-3 { color: var(--hl-3); } 80 | .hl-4 { color: var(--hl-4); } 81 | .hl-5 { color: var(--hl-5); } 82 | .hl-6 { color: var(--hl-6); } 83 | .hl-7 { color: var(--hl-7); } 84 | .hl-8 { color: var(--hl-8); } 85 | pre, code { background: var(--code-background); } 86 | -------------------------------------------------------------------------------- /docs/assets/main.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | "use strict";(()=>{var Qe=Object.create;var ae=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Me=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ce(e))!Re.call(t,i)&&i!==n&&ae(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Qe(Oe(t)):{},Me(e||!t||!t.__esModule?ae(n,"default",{value:t,enumerable:!0}):n,t));var de=_e((ce,he)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var h=t.utils.clone(n)||{};h.position=[a,l],h.index=s.length,s.push(new t.Token(r.slice(a,o),h))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. 3 | `,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ou?h+=2:a==u&&(n+=r[l+1]*i[h+1],l+=2,h+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}if(s.str.length==0&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}s.str.length==1&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var h=s.str.charAt(0),m=s.str.charAt(1),v;m in s.node.edges?v=s.node.edges[m]:(v=new t.TokenSet,s.node.edges[m]=v),s.str.length==1&&(v.final=!0),i.push({node:v,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof ce=="object"?he.exports=n():e.lunr=n()}(this,function(){return t})})()});var le=[];function j(t,e){le.push({selector:e,constructor:t})}var Y=class{constructor(){this.createComponents(document.body)}createComponents(e){le.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r}),r.dataset.hasInstance=String(!0))})})}};var k=class{constructor(e){this.el=e.el}};var J=class{constructor(){this.listeners={}}addEventListener(e,n){e in this.listeners||(this.listeners[e]=[]),this.listeners[e].push(n)}removeEventListener(e,n){if(!(e in this.listeners))return;let r=this.listeners[e];for(let i=0,s=r.length;i{let n=Date.now();return(...r)=>{n+e-Date.now()<0&&(t(...r),n=Date.now())}};var re=class extends J{constructor(){super();this.scrollTop=0;this.lastY=0;this.width=0;this.height=0;this.showToolbar=!0;this.toolbar=document.querySelector(".tsd-page-toolbar"),this.navigation=document.querySelector(".col-menu"),window.addEventListener("scroll",ne(()=>this.onScroll(),10)),window.addEventListener("resize",ne(()=>this.onResize(),10)),this.searchInput=document.querySelector("#tsd-search input"),this.searchInput&&this.searchInput.addEventListener("focus",()=>{this.hideShowToolbar()}),this.onResize(),this.onScroll()}triggerResize(){let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onResize(){this.width=window.innerWidth||0,this.height=window.innerHeight||0;let n=new CustomEvent("resize",{detail:{width:this.width,height:this.height}});this.dispatchEvent(n)}onScroll(){this.scrollTop=window.scrollY||0;let n=new CustomEvent("scroll",{detail:{scrollTop:this.scrollTop}});this.dispatchEvent(n),this.hideShowToolbar()}hideShowToolbar(){let n=this.showToolbar;this.showToolbar=this.lastY>=this.scrollTop||this.scrollTop<=0||!!this.searchInput&&this.searchInput===document.activeElement,n!==this.showToolbar&&(this.toolbar.classList.toggle("tsd-page-toolbar--hide"),this.navigation?.classList.toggle("col-menu--hide")),this.lastY=this.scrollTop}},R=re;R.instance=new re;var X=class extends k{constructor(n){super(n);this.anchors=[];this.index=-1;R.instance.addEventListener("resize",()=>this.onResize()),R.instance.addEventListener("scroll",r=>this.onScroll(r)),this.createAnchors()}createAnchors(){let n=window.location.href;n.indexOf("#")!=-1&&(n=n.substring(0,n.indexOf("#"))),this.el.querySelectorAll("a").forEach(r=>{let i=r.href;if(i.indexOf("#")==-1||i.substring(0,n.length)!=n)return;let s=i.substring(i.indexOf("#")+1),o=document.querySelector("a.tsd-anchor[name="+s+"]"),a=r.parentNode;!o||!a||this.anchors.push({link:a,anchor:o,position:0})}),this.onResize()}onResize(){let n;for(let i=0,s=this.anchors.length;ii.position-s.position);let r=new CustomEvent("scroll",{detail:{scrollTop:R.instance.scrollTop}});this.onScroll(r)}onScroll(n){let r=n.detail.scrollTop+5,i=this.anchors,s=i.length-1,o=this.index;for(;o>-1&&i[o].position>r;)o-=1;for(;o-1&&this.anchors[this.index].link.classList.remove("focus"),this.index=o,this.index>-1&&this.anchors[this.index].link.classList.add("focus"))}};var ue=(t,e=100)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>t(r),e)}};var me=De(de());function ve(){let t=document.getElementById("tsd-search");if(!t)return;let e=document.getElementById("search-script");t.classList.add("loading"),e&&(e.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),e.addEventListener("load",()=>{t.classList.remove("loading"),t.classList.add("ready")}),window.searchData&&t.classList.remove("loading"));let n=document.querySelector("#tsd-search input"),r=document.querySelector("#tsd-search .results");if(!n||!r)throw new Error("The input field or the result list wrapper was not found");let i=!1;r.addEventListener("mousedown",()=>i=!0),r.addEventListener("mouseup",()=>{i=!1,t.classList.remove("has-focus")}),n.addEventListener("focus",()=>t.classList.add("has-focus")),n.addEventListener("blur",()=>{i||(i=!1,t.classList.remove("has-focus"))});let s={base:t.dataset.base+"/"};Fe(t,r,n,s)}function Fe(t,e,n,r){n.addEventListener("input",ue(()=>{Ae(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?fe(e,-1):s.key==="ArrowDown"?fe(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function He(t,e){t.index||window.searchData&&(e.classList.remove("loading"),e.classList.add("ready"),t.data=window.searchData,t.index=me.Index.load(window.searchData.index))}function Ae(t,e,n,r){if(He(r,t),!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o${pe(u.parent,i)}.${l}`);let h=document.createElement("li");h.classList.value=u.classes??"";let m=document.createElement("a");m.href=r.base+u.url,m.innerHTML=l,h.append(m),e.appendChild(h)}}function fe(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function pe(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(ie(t.substring(s,o)),`${ie(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(ie(t.substring(s))),i.join("")}var Ne={"&":"&","<":"<",">":">","'":"'",'"':"""};function ie(t){return t.replace(/[&<>"'"]/g,e=>Ne[e])}var F="mousedown",ye="mousemove",B="mouseup",Z={x:0,y:0},ge=!1,se=!1,je=!1,H=!1,xe=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(xe?"is-mobile":"not-mobile");xe&&"ontouchstart"in document.documentElement&&(je=!0,F="touchstart",ye="touchmove",B="touchend");document.addEventListener(F,t=>{se=!0,H=!1;let e=F=="touchstart"?t.targetTouches[0]:t;Z.y=e.pageY||0,Z.x=e.pageX||0});document.addEventListener(ye,t=>{if(!!se&&!H){let e=F=="touchstart"?t.targetTouches[0]:t,n=Z.x-(e.pageX||0),r=Z.y-(e.pageY||0);H=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{se=!1});document.addEventListener("click",t=>{ge&&(t.preventDefault(),t.stopImmediatePropagation(),ge=!1)});var K=class extends k{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){H||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-menu, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!H&&this.active&&n.target.closest(".col-menu")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var oe;try{oe=localStorage}catch{oe={getItem(){return null},setItem(){}}}var Q=oe;var Le=document.head.appendChild(document.createElement("style"));Le.dataset.for="filters";var ee=class extends k{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),Le.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } 4 | `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var te=class extends k{constructor(n){super(n);this.calculateHeights(),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.textContent.replace(/\s+/g,"-").toLowerCase()}`,this.setLocalStorage(this.fromLocalStorage(),!0),this.summary.addEventListener("click",r=>this.toggleVisibility(r)),this.icon.style.transform=this.getIconRotation()}getIconRotation(n=this.el.open){return`rotate(${n?0:-90}deg)`}calculateHeights(){let n=this.el.open,{position:r,left:i}=this.el.style;this.el.style.position="fixed",this.el.style.left="-9999px",this.el.open=!0,this.expandedHeight=this.el.offsetHeight+"px",this.el.open=!1,this.collapsedHeight=this.el.offsetHeight+"px",this.el.open=n,this.el.style.height=n?this.expandedHeight:this.collapsedHeight,this.el.style.position=r,this.el.style.left=i}toggleVisibility(n){n.preventDefault(),this.el.style.overflow="hidden",this.el.open?this.collapse():this.expand()}expand(n=!0){this.el.open=!0,this.animate(this.collapsedHeight,this.expandedHeight,{opening:!0,duration:n?300:0})}collapse(n=!0){this.animate(this.expandedHeight,this.collapsedHeight,{opening:!1,duration:n?300:0})}animate(n,r,{opening:i,duration:s=300}){if(this.animation)return;let o={duration:s,easing:"ease"};this.animation=this.el.animate({height:[n,r]},o),this.icon.animate({transform:[this.icon.style.transform||this.getIconRotation(!i),this.getIconRotation(i)]},o).addEventListener("finish",()=>{this.icon.style.transform=this.getIconRotation(i)}),this.animation.addEventListener("finish",()=>this.animationEnd(i))}animationEnd(n){this.el.open=n,this.animation=void 0,this.el.style.height="auto",this.el.style.overflow="visible",this.setLocalStorage(n)}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.open}setLocalStorage(n,r=!1){this.fromLocalStorage()===n&&!r||(Q.setItem(this.key,n.toString()),this.el.open=n,this.handleValueChange(r))}handleValueChange(n=!1){this.fromLocalStorage()===this.el.open&&!n||(this.fromLocalStorage()?this.expand(!1):this.collapse(!1))}};function be(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,Ee(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),Ee(t.value)})}function Ee(t){document.documentElement.dataset.theme=t}ve();j(X,".menu-highlight");j(K,"a[data-toggle]");j(te,".tsd-index-accordion");j(ee,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("theme");Se&&be(Se);var Be=new Y;Object.defineProperty(window,"app",{value:Be});})(); 5 | /*! 6 | * lunr.Builder 7 | * Copyright (C) 2020 Oliver Nightingale 8 | */ 9 | /*! 10 | * lunr.Index 11 | * Copyright (C) 2020 Oliver Nightingale 12 | */ 13 | /*! 14 | * lunr.Pipeline 15 | * Copyright (C) 2020 Oliver Nightingale 16 | */ 17 | /*! 18 | * lunr.Set 19 | * Copyright (C) 2020 Oliver Nightingale 20 | */ 21 | /*! 22 | * lunr.TokenSet 23 | * Copyright (C) 2020 Oliver Nightingale 24 | */ 25 | /*! 26 | * lunr.Vector 27 | * Copyright (C) 2020 Oliver Nightingale 28 | */ 29 | /*! 30 | * lunr.stemmer 31 | * Copyright (C) 2020 Oliver Nightingale 32 | * Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt 33 | */ 34 | /*! 35 | * lunr.stopWordFilter 36 | * Copyright (C) 2020 Oliver Nightingale 37 | */ 38 | /*! 39 | * lunr.tokenizer 40 | * Copyright (C) 2020 Oliver Nightingale 41 | */ 42 | /*! 43 | * lunr.trimmer 44 | * Copyright (C) 2020 Oliver Nightingale 45 | */ 46 | /*! 47 | * lunr.utils 48 | * Copyright (C) 2020 Oliver Nightingale 49 | */ 50 | /** 51 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9 52 | * Copyright (C) 2020 Oliver Nightingale 53 | * @license MIT 54 | */ 55 | -------------------------------------------------------------------------------- /docs/assets/search.js: -------------------------------------------------------------------------------- 1 | window.searchData = JSON.parse("{\"kinds\":{\"64\":\"Function\",\"128\":\"Class\",\"256\":\"Interface\",\"512\":\"Constructor\",\"1024\":\"Property\",\"2048\":\"Method\"},\"rows\":[{\"kind\":256,\"name\":\"RedisConnectionPoolConfig\",\"url\":\"interfaces/RedisConnectionPoolConfig.html\",\"classes\":\"tsd-kind-interface\"},{\"kind\":1024,\"name\":\"max_clients\",\"url\":\"interfaces/RedisConnectionPoolConfig.html#max_clients\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"RedisConnectionPoolConfig\"},{\"kind\":1024,\"name\":\"perform_checks\",\"url\":\"interfaces/RedisConnectionPoolConfig.html#perform_checks\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"RedisConnectionPoolConfig\"},{\"kind\":1024,\"name\":\"redis\",\"url\":\"interfaces/RedisConnectionPoolConfig.html#redis\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"RedisConnectionPoolConfig\"},{\"kind\":128,\"name\":\"RedisConnectionPool\",\"url\":\"classes/RedisConnectionPool.html\",\"classes\":\"tsd-kind-class\"},{\"kind\":512,\"name\":\"constructor\",\"url\":\"classes/RedisConnectionPool.html#constructor\",\"classes\":\"tsd-kind-constructor tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":1024,\"name\":\"max_clients\",\"url\":\"classes/RedisConnectionPool.html#max_clients\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":1024,\"name\":\"redis\",\"url\":\"classes/RedisConnectionPool.html#redis\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":1024,\"name\":\"pool\",\"url\":\"classes/RedisConnectionPool.html#pool\",\"classes\":\"tsd-kind-property tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":1024,\"name\":\"initializing\",\"url\":\"classes/RedisConnectionPool.html#initializing\",\"classes\":\"tsd-kind-property tsd-parent-kind-class tsd-is-private\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"blpop\",\"url\":\"classes/RedisConnectionPool.html#blpop\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"brpop\",\"url\":\"classes/RedisConnectionPool.html#brpop\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"del\",\"url\":\"classes/RedisConnectionPool.html#del\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"expire\",\"url\":\"classes/RedisConnectionPool.html#expire\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"get\",\"url\":\"classes/RedisConnectionPool.html#get\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"hdel\",\"url\":\"classes/RedisConnectionPool.html#hdel\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"hget\",\"url\":\"classes/RedisConnectionPool.html#hget\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"hgetall\",\"url\":\"classes/RedisConnectionPool.html#hgetall\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"hset\",\"url\":\"classes/RedisConnectionPool.html#hset\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"incr\",\"url\":\"classes/RedisConnectionPool.html#incr\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"init\",\"url\":\"classes/RedisConnectionPool.html#init\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"keys\",\"url\":\"classes/RedisConnectionPool.html#keys\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"lpush\",\"url\":\"classes/RedisConnectionPool.html#lpush\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"rpush\",\"url\":\"classes/RedisConnectionPool.html#rpush\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"sendCommand\",\"url\":\"classes/RedisConnectionPool.html#sendCommand\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"set\",\"url\":\"classes/RedisConnectionPool.html#set\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"shutdown\",\"url\":\"classes/RedisConnectionPool.html#shutdown\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"ttl\",\"url\":\"classes/RedisConnectionPool.html#ttl\",\"classes\":\"tsd-kind-method tsd-parent-kind-class\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"singleCommand\",\"url\":\"classes/RedisConnectionPool.html#singleCommand\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"RedisConnectionPool\"},{\"kind\":2048,\"name\":\"getFuncs\",\"url\":\"classes/RedisConnectionPool.html#getFuncs\",\"classes\":\"tsd-kind-method tsd-parent-kind-class tsd-is-private\",\"parent\":\"RedisConnectionPool\"},{\"kind\":64,\"name\":\"default\",\"url\":\"functions/default.html\",\"classes\":\"tsd-kind-function\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,30.603]],[\"comment/0\",[]],[\"name/1\",[1,25.494]],[\"comment/1\",[]],[\"name/2\",[2,30.603]],[\"comment/2\",[]],[\"name/3\",[3,25.494]],[\"comment/3\",[]],[\"name/4\",[4,30.603]],[\"comment/4\",[]],[\"name/5\",[5,30.603]],[\"comment/5\",[]],[\"name/6\",[1,25.494]],[\"comment/6\",[]],[\"name/7\",[3,25.494]],[\"comment/7\",[]],[\"name/8\",[6,30.603]],[\"comment/8\",[]],[\"name/9\",[7,30.603]],[\"comment/9\",[]],[\"name/10\",[8,30.603]],[\"comment/10\",[]],[\"name/11\",[9,30.603]],[\"comment/11\",[]],[\"name/12\",[10,30.603]],[\"comment/12\",[]],[\"name/13\",[11,30.603]],[\"comment/13\",[]],[\"name/14\",[12,30.603]],[\"comment/14\",[]],[\"name/15\",[13,30.603]],[\"comment/15\",[]],[\"name/16\",[14,30.603]],[\"comment/16\",[]],[\"name/17\",[15,30.603]],[\"comment/17\",[]],[\"name/18\",[16,30.603]],[\"comment/18\",[]],[\"name/19\",[17,30.603]],[\"comment/19\",[]],[\"name/20\",[18,30.603]],[\"comment/20\",[]],[\"name/21\",[19,30.603]],[\"comment/21\",[]],[\"name/22\",[20,30.603]],[\"comment/22\",[]],[\"name/23\",[21,30.603]],[\"comment/23\",[]],[\"name/24\",[22,30.603]],[\"comment/24\",[]],[\"name/25\",[23,30.603]],[\"comment/25\",[]],[\"name/26\",[24,30.603]],[\"comment/26\",[]],[\"name/27\",[25,30.603]],[\"comment/27\",[]],[\"name/28\",[26,30.603]],[\"comment/28\",[]],[\"name/29\",[27,30.603]],[\"comment/29\",[]],[\"name/30\",[28,30.603]],[\"comment/30\",[]]],\"invertedIndex\":[[\"blpop\",{\"_index\":8,\"name\":{\"10\":{}},\"comment\":{}}],[\"brpop\",{\"_index\":9,\"name\":{\"11\":{}},\"comment\":{}}],[\"constructor\",{\"_index\":5,\"name\":{\"5\":{}},\"comment\":{}}],[\"default\",{\"_index\":28,\"name\":{\"30\":{}},\"comment\":{}}],[\"del\",{\"_index\":10,\"name\":{\"12\":{}},\"comment\":{}}],[\"expire\",{\"_index\":11,\"name\":{\"13\":{}},\"comment\":{}}],[\"get\",{\"_index\":12,\"name\":{\"14\":{}},\"comment\":{}}],[\"getfuncs\",{\"_index\":27,\"name\":{\"29\":{}},\"comment\":{}}],[\"hdel\",{\"_index\":13,\"name\":{\"15\":{}},\"comment\":{}}],[\"hget\",{\"_index\":14,\"name\":{\"16\":{}},\"comment\":{}}],[\"hgetall\",{\"_index\":15,\"name\":{\"17\":{}},\"comment\":{}}],[\"hset\",{\"_index\":16,\"name\":{\"18\":{}},\"comment\":{}}],[\"incr\",{\"_index\":17,\"name\":{\"19\":{}},\"comment\":{}}],[\"init\",{\"_index\":18,\"name\":{\"20\":{}},\"comment\":{}}],[\"initializing\",{\"_index\":7,\"name\":{\"9\":{}},\"comment\":{}}],[\"keys\",{\"_index\":19,\"name\":{\"21\":{}},\"comment\":{}}],[\"lpush\",{\"_index\":20,\"name\":{\"22\":{}},\"comment\":{}}],[\"max_clients\",{\"_index\":1,\"name\":{\"1\":{},\"6\":{}},\"comment\":{}}],[\"perform_checks\",{\"_index\":2,\"name\":{\"2\":{}},\"comment\":{}}],[\"pool\",{\"_index\":6,\"name\":{\"8\":{}},\"comment\":{}}],[\"redis\",{\"_index\":3,\"name\":{\"3\":{},\"7\":{}},\"comment\":{}}],[\"redisconnectionpool\",{\"_index\":4,\"name\":{\"4\":{}},\"comment\":{}}],[\"redisconnectionpoolconfig\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"rpush\",{\"_index\":21,\"name\":{\"23\":{}},\"comment\":{}}],[\"sendcommand\",{\"_index\":22,\"name\":{\"24\":{}},\"comment\":{}}],[\"set\",{\"_index\":23,\"name\":{\"25\":{}},\"comment\":{}}],[\"shutdown\",{\"_index\":24,\"name\":{\"26\":{}},\"comment\":{}}],[\"singlecommand\",{\"_index\":26,\"name\":{\"28\":{}},\"comment\":{}}],[\"ttl\",{\"_index\":25,\"name\":{\"27\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); -------------------------------------------------------------------------------- /docs/assets/style.css: -------------------------------------------------------------------------------- 1 | :root { 2 | /* Light */ 3 | --light-color-background: #f2f4f8; 4 | --light-color-background-secondary: #eff0f1; 5 | --light-color-icon-background: var(--light-color-background); 6 | --light-color-accent: #c5c7c9; 7 | --light-color-text: #222; 8 | --light-color-text-aside: #707070; 9 | --light-color-link: #4da6ff; 10 | --light-color-ts: #db1373; 11 | --light-color-ts-interface: #139d2c; 12 | --light-color-ts-enum: #9c891a; 13 | --light-color-ts-class: #2484e5; 14 | --light-color-ts-function: #572be7; 15 | --light-color-ts-namespace: #b111c9; 16 | --light-color-ts-private: #707070; 17 | --light-color-ts-variable: #4d68ff; 18 | --light-external-icon: url("data:image/svg+xml;utf8,"); 19 | --light-color-scheme: light; 20 | 21 | /* Dark */ 22 | --dark-color-background: #2b2e33; 23 | --dark-color-background-secondary: #1e2024; 24 | --dark-color-icon-background: var(--dark-color-background-secondary); 25 | --dark-color-accent: #9096a2; 26 | --dark-color-text: #f5f5f5; 27 | --dark-color-text-aside: #dddddd; 28 | --dark-color-link: #00aff4; 29 | --dark-color-ts: #ff6492; 30 | --dark-color-ts-interface: #6cff87; 31 | --dark-color-ts-enum: #f4d93e; 32 | --dark-color-ts-class: #61b0ff; 33 | --dark-color-ts-function: #9772ff; 34 | --dark-color-ts-namespace: #e14dff; 35 | --dark-color-ts-private: #e2e2e2; 36 | --dark-color-ts-variable: #4d68ff; 37 | --dark-external-icon: url("data:image/svg+xml;utf8,"); 38 | --dark-color-scheme: dark; 39 | } 40 | 41 | @media (prefers-color-scheme: light) { 42 | :root { 43 | --color-background: var(--light-color-background); 44 | --color-background-secondary: var(--light-color-background-secondary); 45 | --color-icon-background: var(--light-color-icon-background); 46 | --color-accent: var(--light-color-accent); 47 | --color-text: var(--light-color-text); 48 | --color-text-aside: var(--light-color-text-aside); 49 | --color-link: var(--light-color-link); 50 | --color-ts: var(--light-color-ts); 51 | --color-ts-interface: var(--light-color-ts-interface); 52 | --color-ts-enum: var(--light-color-ts-enum); 53 | --color-ts-class: var(--light-color-ts-class); 54 | --color-ts-function: var(--light-color-ts-function); 55 | --color-ts-namespace: var(--light-color-ts-namespace); 56 | --color-ts-private: var(--light-color-ts-private); 57 | --color-ts-variable: var(--light-color-ts-variable); 58 | --external-icon: var(--light-external-icon); 59 | --color-scheme: var(--light-color-scheme); 60 | } 61 | } 62 | 63 | @media (prefers-color-scheme: dark) { 64 | :root { 65 | --color-background: var(--dark-color-background); 66 | --color-background-secondary: var(--dark-color-background-secondary); 67 | --color-icon-background: var(--dark-color-icon-background); 68 | --color-accent: var(--dark-color-accent); 69 | --color-text: var(--dark-color-text); 70 | --color-text-aside: var(--dark-color-text-aside); 71 | --color-link: var(--dark-color-link); 72 | --color-ts: var(--dark-color-ts); 73 | --color-ts-interface: var(--dark-color-ts-interface); 74 | --color-ts-enum: var(--dark-color-ts-enum); 75 | --color-ts-class: var(--dark-color-ts-class); 76 | --color-ts-function: var(--dark-color-ts-function); 77 | --color-ts-namespace: var(--dark-color-ts-namespace); 78 | --color-ts-private: var(--dark-color-ts-private); 79 | --color-ts-variable: var(--dark-color-ts-variable); 80 | --external-icon: var(--dark-external-icon); 81 | --color-scheme: var(--dark-color-scheme); 82 | } 83 | } 84 | 85 | html { 86 | color-scheme: var(--color-scheme); 87 | } 88 | 89 | body { 90 | margin: 0; 91 | } 92 | 93 | :root[data-theme="light"] { 94 | --color-background: var(--light-color-background); 95 | --color-background-secondary: var(--light-color-background-secondary); 96 | --color-icon-background: var(--light-color-icon-background); 97 | --color-accent: var(--light-color-accent); 98 | --color-text: var(--light-color-text); 99 | --color-text-aside: var(--light-color-text-aside); 100 | --color-link: var(--light-color-link); 101 | --color-ts: var(--light-color-ts); 102 | --color-ts-interface: var(--light-color-ts-interface); 103 | --color-ts-enum: var(--light-color-ts-enum); 104 | --color-ts-class: var(--light-color-ts-class); 105 | --color-ts-function: var(--light-color-ts-function); 106 | --color-ts-namespace: var(--light-color-ts-namespace); 107 | --color-ts-private: var(--light-color-ts-private); 108 | --color-ts-variable: var(--light-color-ts-variable); 109 | --external-icon: var(--light-external-icon); 110 | --color-scheme: var(--light-color-scheme); 111 | } 112 | 113 | :root[data-theme="dark"] { 114 | --color-background: var(--dark-color-background); 115 | --color-background-secondary: var(--dark-color-background-secondary); 116 | --color-icon-background: var(--dark-color-icon-background); 117 | --color-accent: var(--dark-color-accent); 118 | --color-text: var(--dark-color-text); 119 | --color-text-aside: var(--dark-color-text-aside); 120 | --color-link: var(--dark-color-link); 121 | --color-ts: var(--dark-color-ts); 122 | --color-ts-interface: var(--dark-color-ts-interface); 123 | --color-ts-enum: var(--dark-color-ts-enum); 124 | --color-ts-class: var(--dark-color-ts-class); 125 | --color-ts-function: var(--dark-color-ts-function); 126 | --color-ts-namespace: var(--dark-color-ts-namespace); 127 | --color-ts-private: var(--dark-color-ts-private); 128 | --color-ts-variable: var(--dark-color-ts-variable); 129 | --external-icon: var(--dark-external-icon); 130 | --color-scheme: var(--dark-color-scheme); 131 | } 132 | 133 | h1, 134 | h2, 135 | h3, 136 | h4, 137 | h5, 138 | h6 { 139 | line-height: 1.2; 140 | } 141 | 142 | h1 { 143 | font-size: 1.875rem; 144 | margin: 0.67rem 0; 145 | } 146 | 147 | h2 { 148 | font-size: 1.5rem; 149 | margin: 0.83rem 0; 150 | } 151 | 152 | h3 { 153 | font-size: 1.25rem; 154 | margin: 1rem 0; 155 | } 156 | 157 | h4 { 158 | font-size: 1.05rem; 159 | margin: 1.33rem 0; 160 | } 161 | 162 | h5 { 163 | font-size: 1rem; 164 | margin: 1.5rem 0; 165 | } 166 | 167 | h6 { 168 | font-size: 0.875rem; 169 | margin: 2.33rem 0; 170 | } 171 | 172 | .uppercase { 173 | text-transform: uppercase; 174 | } 175 | 176 | pre { 177 | white-space: pre; 178 | white-space: pre-wrap; 179 | word-wrap: break-word; 180 | } 181 | 182 | dl, 183 | menu, 184 | ol, 185 | ul { 186 | margin: 1em 0; 187 | } 188 | 189 | dd { 190 | margin: 0 0 0 40px; 191 | } 192 | 193 | .container { 194 | max-width: 1600px; 195 | padding: 0 2rem; 196 | } 197 | 198 | @media (min-width: 640px) { 199 | .container { 200 | padding: 0 4rem; 201 | } 202 | } 203 | @media (min-width: 1200px) { 204 | .container { 205 | padding: 0 8rem; 206 | } 207 | } 208 | @media (min-width: 1600px) { 209 | .container { 210 | padding: 0 12rem; 211 | } 212 | } 213 | 214 | /* Footer */ 215 | .tsd-generator { 216 | border-top: 1px solid var(--color-accent); 217 | padding-top: 1rem; 218 | padding-bottom: 1rem; 219 | max-height: 3.5rem; 220 | } 221 | 222 | .tsd-generator > p { 223 | margin-top: 0; 224 | margin-bottom: 0; 225 | padding: 0 1rem; 226 | } 227 | 228 | .container-main { 229 | display: flex; 230 | justify-content: space-between; 231 | position: relative; 232 | margin: 0 auto; 233 | } 234 | 235 | .col-4, 236 | .col-8 { 237 | box-sizing: border-box; 238 | float: left; 239 | padding: 2rem 1rem; 240 | } 241 | 242 | .col-4 { 243 | flex: 0 0 25%; 244 | } 245 | .col-8 { 246 | flex: 1 0; 247 | flex-wrap: wrap; 248 | padding-left: 0; 249 | } 250 | 251 | @keyframes fade-in { 252 | from { 253 | opacity: 0; 254 | } 255 | to { 256 | opacity: 1; 257 | } 258 | } 259 | @keyframes fade-out { 260 | from { 261 | opacity: 1; 262 | visibility: visible; 263 | } 264 | to { 265 | opacity: 0; 266 | } 267 | } 268 | @keyframes fade-in-delayed { 269 | 0% { 270 | opacity: 0; 271 | } 272 | 33% { 273 | opacity: 0; 274 | } 275 | 100% { 276 | opacity: 1; 277 | } 278 | } 279 | @keyframes fade-out-delayed { 280 | 0% { 281 | opacity: 1; 282 | visibility: visible; 283 | } 284 | 66% { 285 | opacity: 0; 286 | } 287 | 100% { 288 | opacity: 0; 289 | } 290 | } 291 | @keyframes shift-to-left { 292 | from { 293 | transform: translate(0, 0); 294 | } 295 | to { 296 | transform: translate(-25%, 0); 297 | } 298 | } 299 | @keyframes unshift-to-left { 300 | from { 301 | transform: translate(-25%, 0); 302 | } 303 | to { 304 | transform: translate(0, 0); 305 | } 306 | } 307 | @keyframes pop-in-from-right { 308 | from { 309 | transform: translate(100%, 0); 310 | } 311 | to { 312 | transform: translate(0, 0); 313 | } 314 | } 315 | @keyframes pop-out-to-right { 316 | from { 317 | transform: translate(0, 0); 318 | visibility: visible; 319 | } 320 | to { 321 | transform: translate(100%, 0); 322 | } 323 | } 324 | body { 325 | background: var(--color-background); 326 | font-family: "Segoe UI", sans-serif; 327 | font-size: 16px; 328 | color: var(--color-text); 329 | } 330 | 331 | a { 332 | color: var(--color-link); 333 | text-decoration: none; 334 | } 335 | a:hover { 336 | text-decoration: underline; 337 | } 338 | a.external[target="_blank"] { 339 | background-image: var(--external-icon); 340 | background-position: top 3px right; 341 | background-repeat: no-repeat; 342 | padding-right: 13px; 343 | } 344 | 345 | code, 346 | pre { 347 | font-family: Menlo, Monaco, Consolas, "Courier New", monospace; 348 | padding: 0.2em; 349 | margin: 0; 350 | font-size: 0.875rem; 351 | border-radius: 0.8em; 352 | } 353 | 354 | pre { 355 | padding: 10px; 356 | border: 0.1em solid var(--color-accent); 357 | } 358 | pre code { 359 | padding: 0; 360 | font-size: 100%; 361 | } 362 | 363 | blockquote { 364 | margin: 1em 0; 365 | padding-left: 1em; 366 | border-left: 4px solid gray; 367 | } 368 | 369 | .tsd-typography { 370 | line-height: 1.333em; 371 | } 372 | .tsd-typography ul { 373 | list-style: square; 374 | padding: 0 0 0 20px; 375 | margin: 0; 376 | } 377 | .tsd-typography h4, 378 | .tsd-typography .tsd-index-panel h3, 379 | .tsd-index-panel .tsd-typography h3, 380 | .tsd-typography h5, 381 | .tsd-typography h6 { 382 | font-size: 1em; 383 | margin: 0; 384 | } 385 | .tsd-typography h5, 386 | .tsd-typography h6 { 387 | font-weight: normal; 388 | } 389 | .tsd-typography p, 390 | .tsd-typography ul, 391 | .tsd-typography ol { 392 | margin: 1em 0; 393 | } 394 | 395 | @media (max-width: 1024px) { 396 | html .col-content { 397 | float: none; 398 | max-width: 100%; 399 | width: 100%; 400 | padding-top: 3rem; 401 | } 402 | html .col-menu { 403 | position: fixed !important; 404 | overflow-y: auto; 405 | -webkit-overflow-scrolling: touch; 406 | z-index: 1024; 407 | top: 0 !important; 408 | bottom: 0 !important; 409 | left: auto !important; 410 | right: 0 !important; 411 | padding: 1.5rem 1.5rem 0 0; 412 | max-width: 25rem; 413 | visibility: hidden; 414 | background-color: var(--color-background); 415 | transform: translate(100%, 0); 416 | } 417 | html .col-menu > *:last-child { 418 | padding-bottom: 20px; 419 | } 420 | html .overlay { 421 | content: ""; 422 | display: block; 423 | position: fixed; 424 | z-index: 1023; 425 | top: 0; 426 | left: 0; 427 | right: 0; 428 | bottom: 0; 429 | background-color: rgba(0, 0, 0, 0.75); 430 | visibility: hidden; 431 | } 432 | 433 | .to-has-menu .overlay { 434 | animation: fade-in 0.4s; 435 | } 436 | 437 | .to-has-menu :is(header, footer, .col-content) { 438 | animation: shift-to-left 0.4s; 439 | } 440 | 441 | .to-has-menu .col-menu { 442 | animation: pop-in-from-right 0.4s; 443 | } 444 | 445 | .from-has-menu .overlay { 446 | animation: fade-out 0.4s; 447 | } 448 | 449 | .from-has-menu :is(header, footer, .col-content) { 450 | animation: unshift-to-left 0.4s; 451 | } 452 | 453 | .from-has-menu .col-menu { 454 | animation: pop-out-to-right 0.4s; 455 | } 456 | 457 | .has-menu body { 458 | overflow: hidden; 459 | } 460 | .has-menu .overlay { 461 | visibility: visible; 462 | } 463 | .has-menu :is(header, footer, .col-content) { 464 | transform: translate(-25%, 0); 465 | } 466 | .has-menu .col-menu { 467 | visibility: visible; 468 | transform: translate(0, 0); 469 | display: grid; 470 | align-items: center; 471 | grid-template-rows: auto 1fr; 472 | grid-gap: 1.5rem; 473 | max-height: 100vh; 474 | padding: 1rem 2rem; 475 | } 476 | .has-menu .tsd-navigation { 477 | max-height: 100%; 478 | } 479 | } 480 | 481 | .tsd-breadcrumb { 482 | margin: 0; 483 | padding: 0; 484 | color: var(--color-text-aside); 485 | } 486 | .tsd-breadcrumb a { 487 | color: var(--color-text-aside); 488 | text-decoration: none; 489 | } 490 | .tsd-breadcrumb a:hover { 491 | text-decoration: underline; 492 | } 493 | .tsd-breadcrumb li { 494 | display: inline; 495 | } 496 | .tsd-breadcrumb li:after { 497 | content: " / "; 498 | } 499 | 500 | .tsd-comment-tags { 501 | display: flex; 502 | flex-direction: column; 503 | } 504 | dl.tsd-comment-tag-group { 505 | display: flex; 506 | align-items: center; 507 | overflow: hidden; 508 | margin: 0.5em 0; 509 | } 510 | dl.tsd-comment-tag-group dt { 511 | display: flex; 512 | margin-right: 0.5em; 513 | font-size: 0.875em; 514 | font-weight: normal; 515 | } 516 | dl.tsd-comment-tag-group dd { 517 | margin: 0; 518 | } 519 | code.tsd-tag { 520 | padding: 0.25em 0.4em; 521 | border: 0.1em solid var(--color-accent); 522 | margin-right: 0.25em; 523 | font-size: 70%; 524 | } 525 | h1 code.tsd-tag:first-of-type { 526 | margin-left: 0.25em; 527 | } 528 | 529 | dl.tsd-comment-tag-group dd:before, 530 | dl.tsd-comment-tag-group dd:after { 531 | content: " "; 532 | } 533 | dl.tsd-comment-tag-group dd pre, 534 | dl.tsd-comment-tag-group dd:after { 535 | clear: both; 536 | } 537 | dl.tsd-comment-tag-group p { 538 | margin: 0; 539 | } 540 | 541 | .tsd-panel.tsd-comment .lead { 542 | font-size: 1.1em; 543 | line-height: 1.333em; 544 | margin-bottom: 2em; 545 | } 546 | .tsd-panel.tsd-comment .lead:last-child { 547 | margin-bottom: 0; 548 | } 549 | 550 | .tsd-filter-visibility h4 { 551 | font-size: 1rem; 552 | padding-top: 0.75rem; 553 | padding-bottom: 0.5rem; 554 | margin: 0; 555 | } 556 | .tsd-filter-item:not(:last-child) { 557 | margin-bottom: 0.5rem; 558 | } 559 | .tsd-filter-input { 560 | display: flex; 561 | width: fit-content; 562 | width: -moz-fit-content; 563 | align-items: center; 564 | user-select: none; 565 | -webkit-user-select: none; 566 | -moz-user-select: none; 567 | -ms-user-select: none; 568 | cursor: pointer; 569 | } 570 | .tsd-filter-input input[type="checkbox"] { 571 | cursor: pointer; 572 | position: absolute; 573 | width: 1.5em; 574 | height: 1.5em; 575 | opacity: 0; 576 | } 577 | .tsd-filter-input input[type="checkbox"]:disabled { 578 | pointer-events: none; 579 | } 580 | .tsd-filter-input svg { 581 | cursor: pointer; 582 | width: 1.5em; 583 | height: 1.5em; 584 | margin-right: 0.5em; 585 | border-radius: 0.33em; 586 | /* Leaving this at full opacity breaks event listeners on Firefox. 587 | Don't remove unless you know what you're doing. */ 588 | opacity: 0.99; 589 | } 590 | .tsd-filter-input input[type="checkbox"]:focus + svg { 591 | transform: scale(0.95); 592 | } 593 | .tsd-filter-input input[type="checkbox"]:focus:not(:focus-visible) + svg { 594 | transform: scale(1); 595 | } 596 | .tsd-checkbox-background { 597 | fill: var(--color-accent); 598 | } 599 | input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { 600 | stroke: var(--color-text); 601 | } 602 | .tsd-filter-input input:disabled ~ svg > .tsd-checkbox-background { 603 | fill: var(--color-background); 604 | stroke: var(--color-accent); 605 | stroke-width: 0.25rem; 606 | } 607 | .tsd-filter-input input:disabled ~ svg > .tsd-checkbox-checkmark { 608 | stroke: var(--color-accent); 609 | } 610 | 611 | .tsd-theme-toggle { 612 | padding-top: 0.75rem; 613 | } 614 | .tsd-theme-toggle > h4 { 615 | display: inline; 616 | vertical-align: middle; 617 | margin-right: 0.75rem; 618 | } 619 | 620 | .tsd-hierarchy { 621 | list-style: square; 622 | margin: 0; 623 | } 624 | .tsd-hierarchy .target { 625 | font-weight: bold; 626 | } 627 | 628 | .tsd-panel-group.tsd-index-group { 629 | margin-bottom: 0; 630 | } 631 | .tsd-index-panel .tsd-index-list { 632 | list-style: none; 633 | line-height: 1.333em; 634 | margin: 0; 635 | padding: 0.25rem 0 0 0; 636 | overflow: hidden; 637 | display: grid; 638 | grid-template-columns: repeat(3, 1fr); 639 | column-gap: 1rem; 640 | grid-template-rows: auto; 641 | } 642 | @media (max-width: 1024px) { 643 | .tsd-index-panel .tsd-index-list { 644 | grid-template-columns: repeat(2, 1fr); 645 | } 646 | } 647 | @media (max-width: 768px) { 648 | .tsd-index-panel .tsd-index-list { 649 | grid-template-columns: repeat(1, 1fr); 650 | } 651 | } 652 | .tsd-index-panel .tsd-index-list li { 653 | -webkit-page-break-inside: avoid; 654 | -moz-page-break-inside: avoid; 655 | -ms-page-break-inside: avoid; 656 | -o-page-break-inside: avoid; 657 | page-break-inside: avoid; 658 | } 659 | .tsd-index-panel a, 660 | .tsd-index-panel a.tsd-parent-kind-module { 661 | color: var(--color-ts); 662 | } 663 | .tsd-index-panel a.tsd-parent-kind-interface { 664 | color: var(--color-ts-interface); 665 | } 666 | .tsd-index-panel a.tsd-parent-kind-enum { 667 | color: var(--color-ts-enum); 668 | } 669 | .tsd-index-panel a.tsd-parent-kind-class { 670 | color: var(--color-ts-class); 671 | } 672 | .tsd-index-panel a.tsd-kind-module { 673 | color: var(--color-ts-namespace); 674 | } 675 | .tsd-index-panel a.tsd-kind-interface { 676 | color: var(--color-ts-interface); 677 | } 678 | .tsd-index-panel a.tsd-kind-enum { 679 | color: var(--color-ts-enum); 680 | } 681 | .tsd-index-panel a.tsd-kind-class { 682 | color: var(--color-ts-class); 683 | } 684 | .tsd-index-panel a.tsd-kind-function { 685 | color: var(--color-ts-function); 686 | } 687 | .tsd-index-panel a.tsd-kind-namespace { 688 | color: var(--color-ts-namespace); 689 | } 690 | .tsd-index-panel a.tsd-kind-variable { 691 | color: var(--color-ts-variable); 692 | } 693 | .tsd-index-panel a.tsd-is-private { 694 | color: var(--color-ts-private); 695 | } 696 | 697 | .tsd-flag { 698 | display: inline-block; 699 | padding: 0.25em 0.4em; 700 | border-radius: 4px; 701 | color: var(--color-comment-tag-text); 702 | background-color: var(--color-comment-tag); 703 | text-indent: 0; 704 | font-size: 75%; 705 | line-height: 1; 706 | font-weight: normal; 707 | } 708 | 709 | .tsd-anchor { 710 | position: absolute; 711 | top: -100px; 712 | } 713 | 714 | .tsd-member { 715 | position: relative; 716 | } 717 | .tsd-member .tsd-anchor + h3 { 718 | display: flex; 719 | align-items: center; 720 | margin-top: 0; 721 | margin-bottom: 0; 722 | border-bottom: none; 723 | } 724 | .tsd-member [data-tsd-kind] { 725 | color: var(--color-ts); 726 | } 727 | .tsd-member [data-tsd-kind="Interface"] { 728 | color: var(--color-ts-interface); 729 | } 730 | .tsd-member [data-tsd-kind="Enum"] { 731 | color: var(--color-ts-enum); 732 | } 733 | .tsd-member [data-tsd-kind="Class"] { 734 | color: var(--color-ts-class); 735 | } 736 | .tsd-member [data-tsd-kind="Private"] { 737 | color: var(--color-ts-private); 738 | } 739 | 740 | .tsd-navigation a { 741 | display: block; 742 | margin: 0.4rem 0; 743 | border-left: 2px solid transparent; 744 | color: var(--color-text); 745 | text-decoration: none; 746 | transition: border-left-color 0.1s; 747 | } 748 | .tsd-navigation a:hover { 749 | text-decoration: underline; 750 | } 751 | .tsd-navigation ul { 752 | margin: 0; 753 | padding: 0; 754 | list-style: none; 755 | } 756 | .tsd-navigation li { 757 | padding: 0; 758 | } 759 | 760 | .tsd-navigation.primary .tsd-accordion-details > ul { 761 | margin-top: 0.75rem; 762 | } 763 | .tsd-navigation.primary a { 764 | padding: 0.75rem 0.5rem; 765 | margin: 0; 766 | } 767 | .tsd-navigation.primary ul li a { 768 | margin-left: 0.5rem; 769 | } 770 | .tsd-navigation.primary ul li li a { 771 | margin-left: 1.5rem; 772 | } 773 | .tsd-navigation.primary ul li li li a { 774 | margin-left: 2.5rem; 775 | } 776 | .tsd-navigation.primary ul li li li li a { 777 | margin-left: 3.5rem; 778 | } 779 | .tsd-navigation.primary ul li li li li li a { 780 | margin-left: 4.5rem; 781 | } 782 | .tsd-navigation.primary ul li li li li li li a { 783 | margin-left: 5.5rem; 784 | } 785 | .tsd-navigation.primary li.current > a { 786 | border-left: 0.15rem var(--color-text) solid; 787 | } 788 | .tsd-navigation.primary li.selected > a { 789 | font-weight: bold; 790 | border-left: 0.2rem var(--color-text) solid; 791 | } 792 | .tsd-navigation.primary ul li a:hover { 793 | border-left: 0.2rem var(--color-text-aside) solid; 794 | } 795 | .tsd-navigation.primary li.globals + li > span, 796 | .tsd-navigation.primary li.globals + li > a { 797 | padding-top: 20px; 798 | } 799 | 800 | .tsd-navigation.secondary.tsd-navigation--toolbar-hide { 801 | max-height: calc(100vh - 1rem); 802 | top: 0.5rem; 803 | } 804 | .tsd-navigation.secondary > ul { 805 | display: inline; 806 | padding-right: 0.5rem; 807 | transition: opacity 0.2s; 808 | } 809 | .tsd-navigation.secondary ul li a { 810 | padding-left: 0; 811 | } 812 | .tsd-navigation.secondary ul li li a { 813 | padding-left: 1.1rem; 814 | } 815 | .tsd-navigation.secondary ul li li li a { 816 | padding-left: 2.2rem; 817 | } 818 | .tsd-navigation.secondary ul li li li li a { 819 | padding-left: 3.3rem; 820 | } 821 | .tsd-navigation.secondary ul li li li li li a { 822 | padding-left: 4.4rem; 823 | } 824 | .tsd-navigation.secondary ul li li li li li li a { 825 | padding-left: 5.5rem; 826 | } 827 | 828 | a.tsd-index-link { 829 | margin: 0.25rem 0; 830 | font-size: 1rem; 831 | line-height: 1.25rem; 832 | display: inline-flex; 833 | align-items: center; 834 | } 835 | .tsd-accordion-summary > h1, 836 | .tsd-accordion-summary > h2, 837 | .tsd-accordion-summary > h3, 838 | .tsd-accordion-summary > h4, 839 | .tsd-accordion-summary > h5 { 840 | display: inline-flex; 841 | align-items: center; 842 | vertical-align: middle; 843 | margin-bottom: 0; 844 | user-select: none; 845 | -moz-user-select: none; 846 | -webkit-user-select: none; 847 | -ms-user-select: none; 848 | } 849 | .tsd-accordion-summary { 850 | display: block; 851 | cursor: pointer; 852 | } 853 | .tsd-accordion-summary > * { 854 | margin-top: 0; 855 | margin-bottom: 0; 856 | padding-top: 0; 857 | padding-bottom: 0; 858 | } 859 | .tsd-accordion-summary::-webkit-details-marker { 860 | display: none; 861 | } 862 | .tsd-index-accordion .tsd-accordion-summary svg { 863 | margin-right: 0.25rem; 864 | } 865 | .tsd-index-content > :not(:first-child) { 866 | margin-top: 0.75rem; 867 | } 868 | .tsd-index-heading { 869 | margin-top: 1.5rem; 870 | margin-bottom: 0.75rem; 871 | } 872 | 873 | .tsd-kind-icon { 874 | margin-right: 0.5rem; 875 | width: 1.25rem; 876 | height: 1.25rem; 877 | min-width: 1.25rem; 878 | min-height: 1.25rem; 879 | } 880 | .tsd-kind-icon path { 881 | transform-origin: center; 882 | transform: scale(1.1); 883 | } 884 | .tsd-signature > .tsd-kind-icon { 885 | margin-right: 0.8rem; 886 | } 887 | 888 | @media (min-width: 1024px) { 889 | .col-content { 890 | margin: 2rem auto; 891 | } 892 | 893 | .menu-sticky-wrap { 894 | position: sticky; 895 | height: calc(100vh - 2rem); 896 | top: 4rem; 897 | right: 0; 898 | padding: 0 1.5rem; 899 | padding-top: 1rem; 900 | margin-top: 3rem; 901 | transition: 0.3s ease-in-out; 902 | transition-property: top, padding-top, padding, height; 903 | overflow-y: auto; 904 | } 905 | .col-menu { 906 | border-left: 1px solid var(--color-accent); 907 | } 908 | .col-menu--hide { 909 | top: 1rem; 910 | } 911 | .col-menu .tsd-navigation:not(:last-child) { 912 | padding-bottom: 1.75rem; 913 | } 914 | } 915 | 916 | .tsd-panel { 917 | margin-bottom: 2.5rem; 918 | } 919 | .tsd-panel.tsd-member { 920 | margin-bottom: 4rem; 921 | } 922 | .tsd-panel:empty { 923 | display: none; 924 | } 925 | .tsd-panel > h1, 926 | .tsd-panel > h2, 927 | .tsd-panel > h3 { 928 | margin: 1.5rem -1.5rem 0.75rem -1.5rem; 929 | padding: 0 1.5rem 0.75rem 1.5rem; 930 | } 931 | .tsd-panel > h1.tsd-before-signature, 932 | .tsd-panel > h2.tsd-before-signature, 933 | .tsd-panel > h3.tsd-before-signature { 934 | margin-bottom: 0; 935 | border-bottom: none; 936 | } 937 | 938 | .tsd-panel-group { 939 | margin: 4rem 0; 940 | } 941 | .tsd-panel-group.tsd-index-group { 942 | margin: 2rem 0; 943 | } 944 | .tsd-panel-group.tsd-index-group details { 945 | margin: 2rem 0; 946 | } 947 | 948 | #tsd-search { 949 | transition: background-color 0.2s; 950 | } 951 | #tsd-search .title { 952 | position: relative; 953 | z-index: 2; 954 | } 955 | #tsd-search .field { 956 | position: absolute; 957 | left: 0; 958 | top: 0; 959 | right: 2.5rem; 960 | height: 100%; 961 | } 962 | #tsd-search .field input { 963 | box-sizing: border-box; 964 | position: relative; 965 | top: -50px; 966 | z-index: 1; 967 | width: 100%; 968 | padding: 0 10px; 969 | opacity: 0; 970 | outline: 0; 971 | border: 0; 972 | background: transparent; 973 | color: var(--color-text); 974 | } 975 | #tsd-search .field label { 976 | position: absolute; 977 | overflow: hidden; 978 | right: -40px; 979 | } 980 | #tsd-search .field input, 981 | #tsd-search .title { 982 | transition: opacity 0.2s; 983 | } 984 | #tsd-search .results { 985 | position: absolute; 986 | visibility: hidden; 987 | top: 40px; 988 | width: 100%; 989 | margin: 0; 990 | padding: 0; 991 | list-style: none; 992 | box-shadow: 0 0 4px rgba(0, 0, 0, 0.25); 993 | } 994 | #tsd-search .results li { 995 | padding: 0 10px; 996 | background-color: var(--color-background); 997 | } 998 | #tsd-search .results li:nth-child(even) { 999 | background-color: var(--color-background-secondary); 1000 | } 1001 | #tsd-search .results li.state { 1002 | display: none; 1003 | } 1004 | #tsd-search .results li.current, 1005 | #tsd-search .results li:hover { 1006 | background-color: var(--color-accent); 1007 | } 1008 | #tsd-search .results a { 1009 | display: block; 1010 | } 1011 | #tsd-search .results a:before { 1012 | top: 10px; 1013 | } 1014 | #tsd-search .results span.parent { 1015 | color: var(--color-text-aside); 1016 | font-weight: normal; 1017 | } 1018 | #tsd-search.has-focus { 1019 | background-color: var(--color-accent); 1020 | } 1021 | #tsd-search.has-focus .field input { 1022 | top: 0; 1023 | opacity: 1; 1024 | } 1025 | #tsd-search.has-focus .title { 1026 | z-index: 0; 1027 | opacity: 0; 1028 | } 1029 | #tsd-search.has-focus .results { 1030 | visibility: visible; 1031 | } 1032 | #tsd-search.loading .results li.state.loading { 1033 | display: block; 1034 | } 1035 | #tsd-search.failure .results li.state.failure { 1036 | display: block; 1037 | } 1038 | 1039 | .tsd-signature { 1040 | margin: 0 0 1rem 0; 1041 | padding: 1rem 0.5rem; 1042 | border: 1px solid var(--color-accent); 1043 | font-family: Menlo, Monaco, Consolas, "Courier New", monospace; 1044 | font-size: 14px; 1045 | overflow-x: auto; 1046 | } 1047 | 1048 | .tsd-signature-symbol { 1049 | color: var(--color-text-aside); 1050 | font-weight: normal; 1051 | } 1052 | 1053 | .tsd-signature-type { 1054 | font-style: italic; 1055 | font-weight: normal; 1056 | } 1057 | 1058 | .tsd-signatures { 1059 | padding: 0; 1060 | margin: 0 0 1em 0; 1061 | list-style-type: none; 1062 | } 1063 | .tsd-signatures .tsd-signature { 1064 | margin: 0; 1065 | border-color: var(--color-accent); 1066 | border-width: 1px 0; 1067 | transition: background-color 0.1s; 1068 | } 1069 | .tsd-description .tsd-signatures .tsd-signature { 1070 | border-width: 1px; 1071 | } 1072 | 1073 | ul.tsd-parameter-list, 1074 | ul.tsd-type-parameter-list { 1075 | list-style: square; 1076 | margin: 0; 1077 | padding-left: 20px; 1078 | } 1079 | ul.tsd-parameter-list > li.tsd-parameter-signature, 1080 | ul.tsd-type-parameter-list > li.tsd-parameter-signature { 1081 | list-style: none; 1082 | margin-left: -20px; 1083 | } 1084 | ul.tsd-parameter-list h5, 1085 | ul.tsd-type-parameter-list h5 { 1086 | font-size: 16px; 1087 | margin: 1em 0 0.5em 0; 1088 | } 1089 | .tsd-sources { 1090 | margin-top: 1rem; 1091 | font-size: 0.875em; 1092 | } 1093 | .tsd-sources a { 1094 | color: var(--color-text-aside); 1095 | text-decoration: underline; 1096 | } 1097 | .tsd-sources ul { 1098 | list-style: none; 1099 | padding: 0; 1100 | } 1101 | 1102 | .tsd-page-toolbar { 1103 | position: fixed; 1104 | z-index: 1; 1105 | top: 0; 1106 | left: 0; 1107 | width: 100%; 1108 | color: var(--color-text); 1109 | background: var(--color-background-secondary); 1110 | border-bottom: 1px var(--color-accent) solid; 1111 | transition: transform 0.3s ease-in-out; 1112 | } 1113 | .tsd-page-toolbar a { 1114 | color: var(--color-text); 1115 | text-decoration: none; 1116 | } 1117 | .tsd-page-toolbar a.title { 1118 | font-weight: bold; 1119 | } 1120 | .tsd-page-toolbar a.title:hover { 1121 | text-decoration: underline; 1122 | } 1123 | .tsd-page-toolbar .tsd-toolbar-contents { 1124 | display: flex; 1125 | justify-content: space-between; 1126 | height: 2.5rem; 1127 | } 1128 | .tsd-page-toolbar .table-cell { 1129 | position: relative; 1130 | white-space: nowrap; 1131 | line-height: 40px; 1132 | } 1133 | .tsd-page-toolbar .table-cell:first-child { 1134 | width: 100%; 1135 | } 1136 | 1137 | .tsd-page-toolbar--hide { 1138 | transform: translateY(-100%); 1139 | } 1140 | 1141 | .tsd-widget { 1142 | display: inline-block; 1143 | overflow: hidden; 1144 | opacity: 0.8; 1145 | height: 40px; 1146 | transition: opacity 0.1s, background-color 0.2s; 1147 | vertical-align: bottom; 1148 | cursor: pointer; 1149 | } 1150 | .tsd-widget:hover { 1151 | opacity: 0.9; 1152 | } 1153 | .tsd-widget.active { 1154 | opacity: 1; 1155 | background-color: var(--color-accent); 1156 | } 1157 | .tsd-widget.no-caption { 1158 | width: 40px; 1159 | } 1160 | .tsd-widget.no-caption:before { 1161 | margin: 0; 1162 | } 1163 | 1164 | .tsd-widget.options, 1165 | .tsd-widget.menu { 1166 | display: none; 1167 | } 1168 | @media (max-width: 1024px) { 1169 | .tsd-widget.options, 1170 | .tsd-widget.menu { 1171 | display: inline-block; 1172 | } 1173 | } 1174 | input[type="checkbox"] + .tsd-widget:before { 1175 | background-position: -120px 0; 1176 | } 1177 | input[type="checkbox"]:checked + .tsd-widget:before { 1178 | background-position: -160px 0; 1179 | } 1180 | 1181 | img { 1182 | max-width: 100%; 1183 | } 1184 | 1185 | .tsd-anchor-icon { 1186 | display: inline-flex; 1187 | align-items: center; 1188 | margin-left: 0.5rem; 1189 | vertical-align: middle; 1190 | color: var(--color-text); 1191 | } 1192 | 1193 | .tsd-anchor-icon svg { 1194 | width: 1em; 1195 | height: 1em; 1196 | visibility: hidden; 1197 | } 1198 | 1199 | .tsd-anchor-link:hover > .tsd-anchor-icon svg { 1200 | visibility: visible; 1201 | } 1202 | 1203 | .deprecated { 1204 | text-decoration: line-through; 1205 | } 1206 | 1207 | * { 1208 | scrollbar-width: thin; 1209 | scrollbar-color: var(--color-accent) var(--color-icon-background); 1210 | } 1211 | 1212 | *::-webkit-scrollbar { 1213 | width: 0.75rem; 1214 | } 1215 | 1216 | *::-webkit-scrollbar-track { 1217 | background: var(--color-icon-background); 1218 | } 1219 | 1220 | *::-webkit-scrollbar-thumb { 1221 | background-color: var(--color-accent); 1222 | border-radius: 999rem; 1223 | border: 0.25rem solid var(--color-icon-background); 1224 | } 1225 | -------------------------------------------------------------------------------- /docs/assets/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/silverbucket/redis-connection-pool/863a2d6595c169bf8969be03caf8acd10cf277f0/docs/assets/widgets.png -------------------------------------------------------------------------------- /docs/assets/widgets@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/silverbucket/redis-connection-pool/863a2d6595c169bf8969be03caf8acd10cf277f0/docs/assets/widgets@2x.png -------------------------------------------------------------------------------- /docs/functions/default.html: -------------------------------------------------------------------------------- 1 | default | redis-connection-pool
2 |
3 | 8 |
9 |
10 |
11 |
12 | 15 |

Function default

16 |
17 |
    18 | 19 |
  • 20 |

    Function: redisConnectionPoolFactory

    21 |

    A high-level redis management object. It manages a number of connections in 22 | a pool, using them as needed and keeping all aspects of releasing active 23 | connections internal to the object, so the user does not need to worry about 24 | forgotten connections leaking memory and building up over time.

    25 |

    Parameters:

    26 |

    uid - (string) - Unique identifier to retrieve an existing instance from 27 | elsewhere in an application. If left undefined, one will 28 | be generated automatically and available via the uid 29 | property of the returned object.

    30 |

    cfg - (object) - A series of configuration parameters to be optionally 31 | passed in and used during initialization of the object.

    32 |

    cfg.max_clients - (number) - Max clients alive in the connection pool at 33 | once. (default: 30)

    34 |

    cfg.redis - (object) - A redis config object

    35 |

    Returns:

    36 |

    A RedisConnectionPool object

    37 |
    38 |
    39 |

    Parameters

    40 |
    45 |

    Returns Promise<RedisConnectionPool>

48 |
74 |
75 |

Generated using TypeDoc

76 |
-------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | redis-connection-pool
2 |
3 | 8 |
9 |
10 |
11 |
12 |

redis-connection-pool

13 |
14 | 15 |

redis-connection-pool

16 |
17 |

A node.js connection pool for Redis.

18 |

https://silverbucket.github.io/redis-connection-pool

19 |

Build Status 20 | license 21 | downloads

22 | 23 | 24 |

About

25 |
26 |

A high-level redis connection pooling object. It manages 27 | a number of connections in a pool, using them as needed and keeping all aspects 28 | of releasing active connections internal to the object.

29 | 30 | 31 |

Installation

32 |
33 |
npm install redis-connection-pool
 34 | 
35 | 36 | 37 |

Usage

38 |
39 |
import redisPoolFactory from 'redis-connection-pool';
const redisPool = await redisPoolFactory('myRedisPool', {
max_clients: 5, // default
redis: {
url: 'redis://localhost:6379'
}
});


await redisPool.set('test-key', 'foobar');
const foo = await redisPool.get('test-key');
// returns 'foobar' 40 |
41 |

Or you can create a pool instance directly

42 |
import RedisConnectionPool from 'redis-connection-pool';
const redisPool = new RedisConnectionPool();
await redisPool.init(); 43 |
44 |

When you are done

45 |
redisPool.shutdown();
 46 | 
47 | 48 | 49 |

Implemented Redis methods

50 |
51 |
    52 |
  • blpop
  • 53 |
  • brpop
  • 54 |
  • del
  • 55 |
  • expire
  • 56 |
  • get
  • 57 |
  • hdel
  • 58 |
  • hget
  • 59 |
  • hgetall
  • 60 |
  • hset
  • 61 |
  • incr
  • 62 |
  • keys
  • 63 |
  • lpush
  • 64 |
  • rpush
  • 65 |
  • sendCommand
  • 66 |
  • set
  • 67 |
  • ttl
  • 68 |
69 | 70 | 71 |

Additional methods

72 |
73 |
    74 |
  • init
  • 75 |
  • shutdown
  • 76 |
77 | 78 | 79 |

API Documentation

80 |
81 |

For the full documentation on the RedisConnectionPool class, see https://silverbucket.github.io/redis-connection-pool/classes/RedisConnectionPool.html

82 | 83 | 84 |

License

85 |
86 |

MIT

87 |
88 |
114 |
115 |

Generated using TypeDoc

116 |
-------------------------------------------------------------------------------- /docs/interfaces/RedisConnectionPoolConfig.html: -------------------------------------------------------------------------------- 1 | RedisConnectionPoolConfig | redis-connection-pool
2 |
3 | 8 |
9 |
10 |
11 |
12 | 15 |

Interface RedisConnectionPoolConfig

16 |
17 |

Hierarchy

18 |
    19 |
  • RedisConnectionPoolConfig
22 |
23 |
24 |
25 | 26 |
27 |
28 |

Properties

29 |
33 |
34 |

Properties

35 |
36 | 37 |
max_clients?: number
40 |
41 | 42 |
perform_checks?: boolean
45 |
46 | 47 |
redis?: RedisClientOptions<RedisModules, RedisFunctions, RedisScripts>
50 |
78 |
79 |

Generated using TypeDoc

80 |
-------------------------------------------------------------------------------- /docs/modules.html: -------------------------------------------------------------------------------- 1 | redis-connection-pool
2 |
3 | 8 |
9 |
10 |
11 |
12 |

redis-connection-pool

13 |
14 |
15 |

Index

16 |
17 |

Classes

18 |
20 |
21 |

Interfaces

22 |
24 |
25 |

Functions

26 |
default 27 |
28 |
54 |
55 |

Generated using TypeDoc

56 |
-------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "redis-connection-pool", 3 | "version": "4.0.1", 4 | "description": "a redis client connection pool", 5 | "homepage": "https://silverbucket.github.io/redis-connection-pool", 6 | "license": "MIT", 7 | "private": false, 8 | "keywords": [ 9 | "redis", 10 | "client", 11 | "database", 12 | "connection", 13 | "pool", 14 | "manager" 15 | ], 16 | "main": "dist/index.js", 17 | "types": "dist/index.d.ts", 18 | "files": [ 19 | "dist/", 20 | "src/" 21 | ], 22 | "author": { 23 | "name": "Nick Jennings", 24 | "email": "nick@silverbucket.net" 25 | }, 26 | "scripts": { 27 | "release": "npm run lint && npm run test && npm run coverage && npm run build && npm run integration && npm run doc", 28 | "build": "tsc -v && tsc", 29 | "lint:fix": "eslint --fix src/", 30 | "lint": "eslint src/", 31 | "test": "c8 -x src/bootstrap -x \"src/**/*.test.*\" mocha -r ts-node/register src/*.test.ts", 32 | "coverage": "c8 check-coverage --statements 70 --branches 90 --functions 60 --lines 70", 33 | "integration": "mocha -r ts-node/register src/index.integration.ts && yarn run build && mocha dist/index.integration.js", 34 | "doc": "typedoc ./src/index.ts" 35 | }, 36 | "dependencies": { 37 | "debug": "^4.3.4", 38 | "generic-pool": "^3.8.2", 39 | "redis": "^4.3.0" 40 | }, 41 | "devDependencies": { 42 | "@babel/cli": "7.18.10", 43 | "@babel/core": "7.18.13", 44 | "@babel/preset-env": "7.18.10", 45 | "@babel/preset-typescript": "7.18.6", 46 | "@types/chai": "4.3.3", 47 | "@types/debug": "4.1.7", 48 | "@types/eslint": "8.4.6", 49 | "@types/generic-pool": "3.1.11", 50 | "@types/mocha": "9.1.1", 51 | "@types/node": "17.0.23", 52 | "@types/proxyquire": "1.3.28", 53 | "@types/redis": "4.0.11", 54 | "@types/sinon": "10.0.13", 55 | "@typescript-eslint/eslint-plugin": "5.36.1", 56 | "@typescript-eslint/parser": "5.36.1", 57 | "c8": "7.12.0", 58 | "chai": "4.3.6", 59 | "eslint": "8.23.0", 60 | "eslint-plugin-security-node": "1.1.1", 61 | "jsdoc-babel": "0.5.0", 62 | "jsdoc-to-markdown": "7.1.1", 63 | "mocha": "10.0.0", 64 | "proxyquire": "2.1.3", 65 | "sinon": "14.0.0", 66 | "ts-node": "10.9.1", 67 | "typedoc": "0.23.13", 68 | "typescript": "4.8.2" 69 | }, 70 | "repository": { 71 | "type": "git", 72 | "url": "git://github.com/silverbucket/node-redis-connection-pool.git" 73 | }, 74 | "readmeFilename": "README.md", 75 | "bugs": { 76 | "url": "https://github.com/silverbucekt/node-redis-connection-pool/issues" 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /src/index.integration.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | import redisConnectionPoolFactory, {RedisConnectionPool} from './index'; 3 | 4 | const channel = 'redis-connection-pool-tests:'; 5 | const uid = 'redisPoolTest1'; 6 | 7 | describe('Redis Pool', () => { 8 | let pool: RedisConnectionPool; 9 | beforeEach(async () => { 10 | pool = await redisConnectionPoolFactory(uid, 11 | { 12 | redis: { 13 | url: 'redis://localhost:6379' 14 | } 15 | }); 16 | }); 17 | 18 | afterEach(async () => { 19 | const keys = await pool.keys(`${channel}*`); 20 | for (const key of keys) { 21 | await pool.del(`${key}`); 22 | } 23 | }); 24 | 25 | it('can connect to database', () => { 26 | expect(typeof pool).to.eql('object'); 27 | expect(pool.redis.url).to.eql('redis://localhost:6379'); 28 | }); 29 | 30 | it('basic store and fetch', async () => { 31 | expect(await pool.set(channel, 'a value')).to.eql('OK'); 32 | expect(await pool.get(channel)).to.equal('a value'); 33 | }); 34 | 35 | it('hset and hget', async () => { 36 | expect(await pool.hset(channel, 'a name', 'a value')).to.eql(1); 37 | expect(await pool.hget(channel, 'a name')).to.equal('a value'); 38 | }); 39 | 40 | it('hgetall', async () => { 41 | expect(await pool.hset(channel, 'a name', 'a value')).to.eql(1); 42 | expect(await pool.hset(channel, 'b name', 'b value')).to.eql(1); 43 | expect(await pool.hset(channel, 'c name', 'c value')).to.eql(1); 44 | expect(await pool.hset(channel, 'd name', 'd value')).to.eql(1); 45 | expect(await pool.hset(channel, 'e name', 'e value')).to.eql(1); 46 | 47 | expect(await pool.hgetall(channel)).to.eql({ 48 | 'a name': 'a value', 49 | 'b name': 'b value', 50 | 'c name': 'c value', 51 | 'd name': 'd value', 52 | 'e name': 'e value' 53 | }); 54 | }); 55 | 56 | it('push and pop ', async () => { 57 | expect(await pool.rpush(channel, 'foo1')).to.eql(1); 58 | expect(await pool.rpush(channel, 'foo2')).to.eql(2); 59 | expect(await pool.rpush(channel, 'foo3')).to.eql(3); 60 | expect(await pool.lpush(channel, 'foo4')).to.eql(4); 61 | expect(await pool.lpush(channel, 'foo5')).to.eql(5); 62 | 63 | expect(await pool.brpop(channel)).to.eql({ 64 | key: channel, 65 | element: 'foo3' 66 | }); 67 | 68 | expect(await pool.blpop(channel)).to.eql({ 69 | key: channel, 70 | element: 'foo5' 71 | }); 72 | }); 73 | 74 | it('incr', async () => { 75 | expect(await pool.set(channel, 1)).to.eql('OK'); 76 | expect(await pool.incr(channel)).to.eql(2); 77 | expect(await pool.incr(channel)).to.eql(3); 78 | expect(await pool.get(channel)).to.eql('3'); 79 | }); 80 | }); 81 | 82 | describe("Shutdown", () => { 83 | it('', async () => { 84 | const pool = await redisConnectionPoolFactory(uid); 85 | await pool.shutdown(); 86 | }); 87 | }); 88 | -------------------------------------------------------------------------------- /src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { expect } from 'chai'; 2 | //@ts-ignore 3 | import proxyquire from 'proxyquire'; 4 | import * as sinon from 'sinon'; 5 | 6 | const clientFake = { 7 | BLPOP: sinon.stub(), 8 | BRPOP: sinon.stub(), 9 | LPUSH: sinon.stub(), 10 | RPUSH: sinon.stub(), 11 | HGETALL: sinon.stub(), 12 | HGET: sinon.stub(), 13 | HSET: sinon.stub(), 14 | HDEL: sinon.stub(), 15 | GET: sinon.stub(), 16 | SET: sinon.stub(), 17 | DEL: sinon.stub(), 18 | connect: sinon.stub(), 19 | quit: sinon.stub(), 20 | keys: sinon.stub() 21 | } 22 | 23 | function createPoolFake(factory, opts) { 24 | return { 25 | init: sinon.stub(), 26 | acquire: async () => { 27 | return clientFake; 28 | }, 29 | release: async () => {}, 30 | drain: sinon.stub(), 31 | clear: sinon.stub() 32 | } 33 | } 34 | 35 | const NRCPMod = proxyquire('./index', { 36 | 'generic-pool': { 37 | createPool: createPoolFake 38 | }, 39 | 'redis': { 40 | createClient: () => clientFake 41 | } 42 | }); 43 | const RedisConnectionPool = NRCPMod.RedisConnectionPool; 44 | const redisConnectionPoolFactory = NRCPMod.default; 45 | 46 | describe('redisConnectionPoolFactory', () => { 47 | let pool; 48 | 49 | beforeEach(async () => { 50 | pool = await redisConnectionPoolFactory('foo', { 51 | max_clients: 99, 52 | redis: { 53 | host: 'some host', 54 | port: 876 55 | } 56 | }); 57 | expect(pool.max_clients).to.equal(99); 58 | for (const key of Object.keys(clientFake)) { 59 | clientFake[key].reset(); 60 | } 61 | }) 62 | 63 | it('returns a pool', () => { 64 | expect(pool instanceof RedisConnectionPool).to.equal(true); 65 | expect(typeof pool.init).to.equal('function'); 66 | }); 67 | 68 | it('can initialize pool', () => { 69 | pool.init(); 70 | expect(typeof pool.pool).to.equal('object'); 71 | }); 72 | 73 | it('set', async () => { 74 | await pool.set('some key', 'a value'); 75 | sinon.assert.calledWith(clientFake.SET, 'some key', 'a value') 76 | }); 77 | 78 | it('get', async () => { 79 | clientFake.GET.returns('test'); 80 | const res = await pool.get('some key'); 81 | sinon.assert.calledWith(clientFake.GET, 'some key'); 82 | sinon.assert.calledOnce(clientFake.GET); 83 | expect(res).to.equal('test'); 84 | }); 85 | 86 | it('hset', async () => { 87 | await pool.hset('identifier', 'a key', 'a value'); 88 | await pool.hset('identifier', 'foo', 'bar'); 89 | await pool.hset('identifier', 'grad', 'darg'); 90 | sinon.assert.calledThrice(clientFake.HSET); 91 | sinon.assert.calledWith(clientFake.HSET, 'identifier', 'a key', 'a value'); 92 | sinon.assert.calledWith(clientFake.HSET, 'identifier', 'foo', 'bar'); 93 | sinon.assert.calledWith(clientFake.HSET, 'identifier', 'grad', 'darg'); 94 | }); 95 | 96 | it('hget', async () => { 97 | clientFake.HGET.returns('bar'); 98 | expect(await pool.hget('identifier', 'foo')).to.equal('bar'); 99 | sinon.assert.calledWith(clientFake.HGET, 'identifier', 'foo'); 100 | sinon.assert.calledOnce(clientFake.HGET); 101 | }); 102 | 103 | it('hgetall', async () => { 104 | clientFake.HGETALL.returns('yarg') 105 | expect(await pool.hgetall('identifier')).to.eql('yarg'); 106 | sinon.assert.calledOnce(clientFake.HGETALL); 107 | }); 108 | 109 | it('hdel', async () => { 110 | clientFake.HDEL.returns(1); 111 | expect(await pool.hdel('identifier', ['identifier 2'])).to.eql(1); 112 | sinon.assert.calledOnce(clientFake.HDEL); 113 | sinon.assert.calledWith(clientFake.HDEL, 'identifier', 'identifier 2') 114 | }); 115 | 116 | it('rpush', async () => { 117 | await pool.rpush('identifier', 'a value'); 118 | await pool.rpush('identifier', 'foo'); 119 | await pool.rpush('identifier', 'darg'); 120 | sinon.assert.calledThrice(clientFake.RPUSH); 121 | sinon.assert.calledWith(clientFake.RPUSH, 'identifier', 'a value'); 122 | sinon.assert.calledWith(clientFake.RPUSH, 'identifier', 'foo'); 123 | sinon.assert.calledWith(clientFake.RPUSH, 'identifier', 'darg'); 124 | }) 125 | 126 | it('lpush', async () => { 127 | await pool.lpush('identifier', 'margen'); 128 | await pool.lpush('different identifier', 'janicme'); 129 | sinon.assert.calledTwice(clientFake.LPUSH); 130 | sinon.assert.calledWith(clientFake.LPUSH, 'identifier', 'margen'); 131 | sinon.assert.calledWith(clientFake.LPUSH, 'different identifier', 'janicme'); 132 | }); 133 | 134 | it('brpop', async () => { 135 | clientFake.BRPOP.returns('yo'); 136 | expect(await pool.brpop('identifier')).to.equal('yo'); 137 | clientFake.BRPOP.returns('lo'); 138 | expect(await pool.brpop('identifier')).to.equal('lo'); 139 | sinon.assert.calledTwice(clientFake.BRPOP); 140 | }); 141 | 142 | it('blpop', async () => { 143 | clientFake.BLPOP.returns('yarg'); 144 | expect(await pool.blpop('identifier')).to.equal('yarg'); 145 | clientFake.BLPOP.returns('gray'); 146 | expect(await pool.blpop('identifier')).to.equal('gray'); 147 | sinon.assert.calledTwice(clientFake.BLPOP); 148 | }); 149 | 150 | it('del', async () => { 151 | await pool.del('hummus'); 152 | sinon.assert.calledOnce(clientFake.DEL); 153 | sinon.assert.calledWith(clientFake.DEL, 'hummus'); 154 | }); 155 | 156 | it('shutdown', async () => { 157 | await pool.shutdown(); 158 | }); 159 | }); 160 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * redis-connection-pool 3 | * 4 | * copyright 2012 - 2022 Nick Jennings (https://github.com/silverbucket) 5 | * 6 | * licensed under the MIT license. 7 | * See the LICENSE file for details. 8 | * 9 | * The latest version can be found here: 10 | * 11 | * https://github.com/silverbucket/node-redis-connection-pool 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 | */ 17 | import { 18 | createClient, 19 | RedisClientOptions, RedisClientType, 20 | } from 'redis'; 21 | import {createPool, Pool} from 'generic-pool'; 22 | import debug from 'debug'; 23 | 24 | const log = debug('redis-connection-pool'); 25 | const connectionPools = new Map(); 26 | 27 | export interface RedisConnectionPoolConfig { 28 | max_clients?: number 29 | perform_checks?: boolean; 30 | redis?: RedisClientOptions; 31 | } 32 | 33 | type SingleCommandResult = 34 | string | number | boolean | Buffer | { [x: string]: string | Buffer; } | 35 | { key: string | Buffer; element: string | Buffer; } | (string | Buffer)[] 36 | 37 | /** 38 | * List of redis commands which have been implemented by the RedisConnectionPool class 39 | */ 40 | type FuncNames = 'HDEL' | 'DEL' | 'GET' | 'HGETALL' | 'TTL' | 'INCR' | 41 | 'BRPOP' | 'HGET' | 'BLPOP' | 'EXPIRE' | 'KEYS'; 42 | 43 | type IdentifierType = string; 44 | 45 | /** 46 | * Function: redisConnectionPoolFactory 47 | * 48 | * A high-level redis management object. It manages a number of connections in 49 | * a pool, using them as needed and keeping all aspects of releasing active 50 | * connections internal to the object, so the user does not need to worry about 51 | * forgotten connections leaking memory and building up over time. 52 | * 53 | * Parameters: 54 | * 55 | * uid - (string) - Unique identifier to retrieve an existing instance from 56 | * elsewhere in an application. If left undefined, one will 57 | * be generated automatically and available via the `uid` 58 | * property of the returned object. 59 | * 60 | * cfg - (object) - A series of configuration parameters to be optionally 61 | * passed in and used during initialization of the object. 62 | * 63 | * 64 | * cfg.max_clients - (number) - Max clients alive in the connection pool at 65 | * once. (default: 30) 66 | * 67 | * cfg.redis - (object) - A redis config object 68 | * 69 | * Returns: 70 | * 71 | * A RedisConnectionPool object 72 | */ 73 | export default async function redisConnectionPoolFactory( 74 | uid: IdentifierType, 75 | cfg: RedisConnectionPoolConfig = {} 76 | ): Promise { 77 | let pool; 78 | if (! connectionPools.has(uid)) { 79 | pool = new RedisConnectionPool(cfg); 80 | connectionPools.set(uid, pool); 81 | await pool.init(); 82 | } else { 83 | pool = connectionPools.get(uid); 84 | } 85 | return pool; 86 | } 87 | 88 | /** 89 | * RedisConnectionPool 90 | */ 91 | export class RedisConnectionPool { 92 | max_clients = 5; 93 | redis: RedisClientOptions; 94 | pool: Pool; 95 | private initializing = false; 96 | 97 | constructor(cfg: RedisConnectionPoolConfig = {}) { 98 | this.max_clients = cfg.max_clients || this.max_clients; 99 | this.redis = cfg.redis; 100 | } 101 | 102 | /** 103 | * Execute a redis BLPOP command 104 | * 105 | * @param key - The list key 106 | */ 107 | async blpop(key: string): Promise<{key: string, element: SingleCommandResult}> { 108 | return await this.getFuncs('BLPOP', key); 109 | } 110 | 111 | /** 112 | * Execute a redis BRPOP command 113 | * 114 | * @param key - The list key 115 | */ 116 | async brpop(key: string): Promise<{key: string, element: SingleCommandResult}> { 117 | return await this.getFuncs('BRPOP', key); 118 | } 119 | 120 | /** 121 | * Execute a redis DEL command 122 | * 123 | * @param key - The key of the value you wish to delete 124 | */ 125 | async del(key: string): Promise { 126 | return await this.singleCommand('DEL', [key]) as number; 127 | } 128 | 129 | /** 130 | * Execute a redis EXPIRE command 131 | * 132 | * @param key - A key to assign value to 133 | * @param ttl - TTL in seconds 134 | */ 135 | async expire(key: string, ttl: number): Promise { 136 | return await this.singleCommand('EXPIRE', [key, ttl]) as number; 137 | } 138 | 139 | /** 140 | * Execute a redis GET command 141 | * 142 | * @param key - The key of the value you wish to get 143 | */ 144 | async get(key: string): Promise { 145 | return await this.getFuncs('GET', key); 146 | } 147 | 148 | /** 149 | * Execute a redis HDEL command 150 | * 151 | * @param key - The key of the value you wish to delete 152 | * @param fields - Array of additional field names to be deleted 153 | */ 154 | async hdel(key: string, fields: Array): Promise { 155 | return await this.singleCommand('HDEL', [key].concat(fields)) as number; 156 | } 157 | 158 | /** 159 | * Execute a redis HGET command 160 | * 161 | * @param key - The key of the hash you wish to get 162 | * @param field - The field name to retrieve 163 | */ 164 | async hget(key: string, field: string): Promise { 165 | return await this.getFuncs('HGET', key, field); 166 | } 167 | 168 | /** 169 | * Execute a redis HGETALL command 170 | * 171 | * @param key - The key of the hash you wish to get 172 | */ 173 | async hgetall(key: string): Promise<{[index: string]: string}> { 174 | return await this.getFuncs<{[index: string]: string}>('HGETALL', key); 175 | } 176 | 177 | /** 178 | * Execute a redis HSET command 179 | * 180 | * @param key - A key to assign the hash to 181 | * @param field - Name of the field to set 182 | * @param data - Value to assign to hash 183 | */ 184 | async hset(key: string, field: string, data: string): Promise { 185 | const client = await this.pool.acquire(); 186 | const res = client.HSET(key, field, data); 187 | await this.pool.release(client); 188 | return res; 189 | } 190 | 191 | /** 192 | * Execute a redis INCR command 193 | * 194 | * @param key - A key whose value you wish to increment 195 | */ 196 | async incr(key: string): Promise { 197 | return await this.getFuncs('INCR', key); 198 | } 199 | 200 | /** 201 | * Initializes the Redis connection pool, connecting to redis. 202 | */ 203 | async init(): Promise { 204 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment 205 | // @ts-ignore 206 | this.pool = createPool({ 207 | create: async () => { 208 | log('create'); 209 | if (this.initializing) { 210 | log( 211 | 'Create method already called. (Redis config error? ' + 212 | 'or maybe you forgot to await the init function?)'); 213 | throw Error( 214 | 'Create method already called. (Redis config error? ' + 215 | 'or maybe you forgot to await the init function?)'); 216 | } else { 217 | this.initializing = true; 218 | } 219 | const client = createClient(this.redis); 220 | client.on('error', (err) => { 221 | throw new Error(err); 222 | }); 223 | client.on('ready', () => { 224 | log('ready'); 225 | }); 226 | log('connecting'); 227 | await client.connect(); 228 | this.initializing = false; 229 | return client; 230 | }, 231 | destroy: async (client) => { 232 | await client.quit(); 233 | } 234 | }, { 235 | max: this.max_clients 236 | }); 237 | } 238 | 239 | /** 240 | * Execute a redis KEYS command 241 | * 242 | * @param key - The prefix of the keys to return 243 | */ 244 | async keys(key: string): Promise> { 245 | return await this.singleCommand('KEYS', [key]) as Array; 246 | } 247 | 248 | /** 249 | * Execute a redis LPUSH command 250 | * 251 | * @param key - The list key 252 | * @param data - Value to assign to the list 253 | */ 254 | async lpush(key: string, data: string): Promise { 255 | const client = await this.pool.acquire(); 256 | const res = client.LPUSH(key, data); 257 | await this.pool.release(client); 258 | return res; 259 | } 260 | 261 | /** 262 | * Execute a redis RPUSH command 263 | * 264 | * @param key - The list key 265 | * @param data - Value to assign to the list 266 | */ 267 | async rpush(key: string, data: string): Promise { 268 | const client = await this.pool.acquire(); 269 | const res = client.RPUSH(key, data); 270 | await this.pool.release(client); 271 | return res; 272 | } 273 | 274 | /** 275 | * Sends an explicit command to the redis server. Helpful for all the commands in redis 276 | * that aren't supported natively by this pool API. 277 | * 278 | * @param command_name - Name of redis command to execute 279 | * @param args - List of arguments for the redis command 280 | * 281 | * @example 282 | * 283 | * sendCommand('ECHO', ['Hello Redis'] ) 284 | * 285 | */ 286 | async sendCommand(command_name: string, args: Array): Promise { 287 | return await this.singleCommand(command_name as FuncNames, args); 288 | } 289 | 290 | /** 291 | * Execute a redis SET command 292 | * 293 | * @param key - A key to assign value to 294 | * @param data - Value to assign to key 295 | * @param ttl - TTL (Time to Live) in seconds 296 | */ 297 | async set(key: string, data: string|number, ttl = 0): Promise { 298 | const client = await this.pool.acquire(); 299 | const res = client.SET(key, data, { "EX": ttl }); 300 | await this.pool.release(client); 301 | return res; 302 | } 303 | 304 | /** 305 | * Drain the pool and close all connections to Redis. 306 | */ 307 | async shutdown(): Promise { 308 | await this.pool.drain(); 309 | await this.pool.clear(); 310 | } 311 | 312 | /** 313 | * Execute a redis TTL command 314 | * 315 | * @param {string} key - A key whose TTL(time-to-expire) will be returned 316 | */ 317 | async ttl(key: string): Promise { 318 | return await this.getFuncs('TTL', key); 319 | } 320 | 321 | private async singleCommand( 322 | funcName: FuncNames, 323 | functionParams: Array = [] 324 | ): Promise { 325 | const client = await this.pool.acquire(); 326 | const res = await client[funcName](...functionParams); 327 | await this.pool.release(client); 328 | return res; 329 | } 330 | 331 | private async getFuncs( 332 | funcName: FuncNames, 333 | key: string, 334 | field: string | undefined = undefined 335 | ): Promise { 336 | const client = await this.pool.acquire(); 337 | let res; 338 | if ((funcName === 'GET') || (funcName === 'HGETALL') || 339 | (funcName === 'TTL') || (funcName === 'INCR')) { 340 | res = await client[funcName](key); 341 | } else if ((funcName === 'BLPOP') || (funcName === 'BRPOP')) { 342 | res = await client[funcName](key, 0); 343 | } else if (funcName === 'HGET') { 344 | res = await client.HGET(key, field); 345 | } 346 | await this.pool.release(client); 347 | return res; 348 | } 349 | } 350 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "incremental": false, 5 | "baseUrl": ".", 6 | "moduleResolution": "node", 7 | "module": "commonjs", 8 | "target": "es6", 9 | "lib": [ 10 | "esnext" 11 | ], 12 | "types": [ 13 | "node", "mocha" 14 | ], 15 | "sourceMap": true, 16 | "declaration": true, 17 | "esModuleInterop": true, 18 | "alwaysStrict": true, 19 | "strictNullChecks": false, 20 | "noImplicitAny": false, 21 | "noImplicitReturns": true, 22 | "noImplicitThis": false, 23 | "noUnusedLocals": true, 24 | "resolveJsonModule": true, 25 | "downlevelIteration": true, 26 | "allowJs": false, 27 | "outDir": "dist", 28 | "rootDir": "src", 29 | "sourceRoot": "/", 30 | "mapRoot": "/" 31 | }, 32 | "include": [ 33 | "src" 34 | ], 35 | "exclude": [ 36 | "**/*.test.ts", 37 | "node_modules", 38 | "dist", 39 | "*.d.ts" 40 | ] 41 | } 42 | --------------------------------------------------------------------------------