simple-redis-pool
Version:
Simplistic node redis pool ready can scale with generic-pool support
161 lines (123 loc) • 8.18 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Home - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="RedisPool.html">RedisPool</a><ul class='methods'><li data-type='method'><a href="RedisPool.html#acquire">acquire</a></li><li data-type='method'><a href="RedisPool.html#availableCount">availableCount</a></li><li data-type='method'><a href="RedisPool.html#destroy">destroy</a></li><li data-type='method'><a href="RedisPool.html#drain">drain</a></li><li data-type='method'><a href="RedisPool.html#getName">getName</a></li><li data-type='method'><a href="RedisPool.html#getPoolOptions">getPoolOptions</a></li><li data-type='method'><a href="RedisPool.html#getPoolSize">getPoolSize</a></li><li data-type='method'><a href="RedisPool.html#getRedisOptions">getRedisOptions</a></li><li data-type='method'><a href="RedisPool.html#pendingCount">pendingCount</a></li><li data-type='method'><a href="RedisPool.html#release">release</a></li><li data-type='method'><a href="RedisPool.html#sendCommand">sendCommand</a></li><li data-type='method'><a href="RedisPool.html#status">status</a></li></ul></li></ul>
</nav>
<div id="main">
<section class="readme">
<article><p><a href="https://npmjs.org/package/simple-redis-pool"><img src="https://img.shields.io/npm/v/simple-redis-pool.svg?style=flat-square" alt="npm version"></a>
<a href="https://travis-ci.org/pasupulaphani/simple-redis-pool"><img src="https://travis-ci.org/pasupulaphani/simple-redis-pool.svg?branch=master" alt="Build Status"></a>
<a href="https://coveralls.io/github/pasupulaphani/simple-redis-pool?branch=master"><img src="https://coveralls.io/repos/github/pasupulaphani/simple-redis-pool/badge.svg?branch=master" alt="Coverage Status"></a>
<a href="https://www.versioneye.com/user/projects/583c0c58d2d44d004530834c"><img src="https://www.versioneye.com/user/projects/583c0c58d2d44d004530834c/badge.svg?style=flat-square" alt="Dependency Status"></a>
<a href="https://gratipay.com/simple-redis-store/"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg?style=flat-square" alt="Gratipay donate button"></a></p>
<h1>simple-redis-pool <a href="https://github.com/pasupulaphani/simple-redis-pool"><img src="https://github.com/themes/tactile/images/octocat-icon.png" alt="See on Github"></a></h1><p>Simplistic node redis pool ready can scale with generic-pool support</p>
<h2>Prerequisites</h2><p><code>node >= 4</code> This module requires nodejs v4 or above as it has dependencies on es6 components such as Map, Set, Promise etc.</p>
<h3>Getting started</h3><pre class="prettyprint source"><code> npm install simple-redis-pool</code></pre><h4>Usage</h4><ul>
<li><p>Seemless execution of commands.</p>
<pre class="prettyprint source"><code> var RedisPool = require("simple-redis-pool");
var pool = new RedisPool();
pool.sendCommand("set", ["key", "value"])</code></pre></li>
<li><p>Want redis raw connection? you got it</p>
<pre class="prettyprint source"><code> pool.acquire()
.then(conn => {
// Do some work
// At the end release the conn back to the pool
pool.release(conn)
});</code></pre></li>
</ul>
<h4>API</h4><ul>
<li>RedisPool([options])</li>
</ul>
<h5><code>options</code> object properties</h5><table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">
<p>Name your pool</p>
</td>
</tr>
<tr>
<td class="name"><code>redisOptions</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">
<p>opts from <a href="https://github.com/NodeRedis/node_redis#options-object-properties">node_redis#options-object-properties</a></p>
</td>
</tr>
<tr>
<td class="name"><code>poolOptions</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">
<p>opts from <a href="https://github.com/coopernurse/node-pool#createpool">node-pool#createpool</a></p>
</td>
</tr>
<tr>
<td class="name"><code>logger</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">
<p>Inject your custom logger</p>
</td>
</tr>
</tbody>
</table>
<h3>Run tests</h3><pre class="prettyprint source"><code>bash test.sh</code></pre><h2>Contribute</h2><p><a href="https://github.com/pasupulaphani/simple-redis-pool/blob/master/CONTRIBUTING.md">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a></p>
<h2>Backers</h2><h3>Maintainers</h3><p>These amazing people are maintaining this project:</p>
<ul>
<li><a href="https://github.com/pasupulaphani">Phani</a> — <a href="https://github.com/pasupulaphani/simple-redis-pool/commits?author=pasupulaphani">view contributions</a></li>
</ul>
<h3>Sponsors</h3><p>No sponsors yet! Will you be the first?</p>
<p><a href="http://patreon.com/phaninder" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button"></a>
<a href="https://gratipay.com/~pasupulaphani/" title="Donate weekly to this project using Gratipay"><img src="https://img.shields.io/badge/gratipay-donate-yellow.svg" alt="Gratipay donate button"></a>
<a href="https://flattr.com/profile/pasupulaphani" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button"></a>
<!-- [](https://phaninder.com/paypal "Donate to this project using Paypal") -->
<!-- [](https://phaninder.com/bitcoin "Donate once-off to this project using Bitcoin") -->
<!-- [](https://phaninder.com/wishlist "Buy an item on our wishlist for us") --></p>
<h3>Contributors</h3><p>These amazing people have contributed to/reviewed this project:</p>
<ul>
<li><a href="https://github.com/oliverbrooks">Oliver Brooks</a></li>
</ul>
<p><a href="https://github.com/pasupulaphani/simple-redis-pool/blob/master/CONTRIBUTING.md">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a></p>
<p><br /></p>
<h2><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', 'UA-57413413-3', 'auto');ga('send', 'pageview');</script></h2></article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/linenumber.js"></script>
</body>
</html>