title: Set Rack session cookie expiration programmatically
body: <p>I'm using Rack to try to implement "Remember Me" functionality in my Sinatra app.</p>
  
  <p>I'm able to set the session cookie to expire when the session ends or in X seconds time but I'd like to do both.</p>
  
  <p>For example, if a user has clicked "remember me" then I wish for their session to end after X seconds. Eg, my app.rb has a line that looks like this:</p>
  
  <pre><code>use Rack::Session::Cookie, :expire_after =&gt; 2592000, #30 days in seconds
                             :secret =&gt; MY_SECRET
  </code></pre>
  
  <p>I've tried to do the following when the user logs in:</p>
  
  <pre><code>if (!remember_me)
    env['rack.session.options'][:expire_after] = nil
  end
  </code></pre>
  
  <p>However, this does not set the cookie value. </p>
  
  <p>How to set this?</p>