title: connect-redis and express sessions
body: <p>Being somewhat new to node/express, I've been working on a project for myself to be sure I have the fundamentals down.  At the moment, I'm really focusing on sessions.</p>
  
  <p>I have a back-end session store set up via redis and use connect-redis to simplify things within the app.  I've been playing around with the cookie <code>maxAge</code> and connect-redis <code>TTL</code> and have a single (hopefully simple) question.</p>
  
  <p><strong>Is it best practice to set both connect-redis <code>TTL</code> option <em>and</em> the cookie <code>maxAge</code> or is <code>maxAge</code> sufficient?</strong></p>
  
  <p>Obligatory code:</p>
  
  <pre><code>app.use(express.session({
    secret:'stackoverflowrulz',
    store: new RedisStore({ host: 'example.com', port: 6379, client: redis, ttl: 3600000 }),
    cookie: { maxAge: 3600000 }
  }));
  </code></pre>
  
  <p>It <em>seems</em> like the <code>maxAge</code> cookie setting "flows through" based upon what I see around line 118 in the <a href="https://github.com/visionmedia/connect-redis/blob/master/lib/connect-redis.js" rel="nofollow">connect-redis source</a> but I'm not an expert coder and I can't find written documentation to confirm what I <em>think</em> I'm reading.  </p>