title: Storing Express sessions on Memcached
body: <p>I am working on an node+express application and using <a href="https://github.com/balor/connect-memcached" rel="nofollow noreferrer">connect-memcached</a> for storing express sessions which uses <a href="https://github.com/3rd-Eden/memcached" rel="nofollow noreferrer">Memcached</a> client for communicating with the Memcached server. I want to use Memcached via a pool of connections. So far I have tried this:-</p>
  <pre><code>var session = require('express-session');
  var MemcachedStore = require('connect-memcached')(session);
  var servers = [];
  if (typeof cacheAddr === 'string') servers.push(cacheAddr + ':' + cachePort);
  else {
    for(var i = 0; i &lt; cacheAddr.length; i++)
      servers.push(cacheAddr[i] + ':' + cachePort);
    }
    var store = {
      secret  : secret,
      key     : 'its',
      proxy   : 'true',
      store   : new MemcachedStore({
        hosts: servers,
        prefix: 'sess:',
        poolSize: 200
      }),
      saveUninitialized: true,
      resave: true,
      unset: 'destroy'
    };
  }
  var sessionStore = session(store);
  </code></pre>
  <p>netstat on my memcached server shows 2 connections from my application server.
  Any idea, how to go about this?</p>