title: Node.js + Express + Redis, when to close connection?
body: <p>I have a Node application that uses <a href="http://expressjs.com/" rel="noreferrer">Express</a> and <a href="https://github.com/mranney/node_redis" rel="noreferrer">node_redis</a>. I'm following the approach outlined in the <a href="http://shop.oreilly.com/product/0636920024606.do" rel="noreferrer">Learning Node</a> book and creating a single client for the life of the application. Given this approach, when do I call <code>close()</code> on the redis client? Do I even need to?</p>
  
  <p>Relevant code</p>
  
  <pre><code>var express = require( 'express' ),
      redis = require( 'redis' );
  
  var app = express(),
      config = require( './config/application' )[ app.get( 'env' ) ];
  
  // create Redis client
  var redisClient = redis.createClient();
  redisClient.on( 'error', function( err ) {
    console.log( 'Error' + err );
  } );
  // select the database
  redisClient.select( config.redis_database );
  
  ...
  /* more setup, route defintions, etc. */
  ...
  
  http.createServer( app ).listen( 4000, function() {
    console.log( 'Server started and ready for action!' );
  });
  </code></pre>