{"issue":{"milestone":null,"user":{"id":470585,"login":"bohlander","url":"https://api.github.com/users/bohlander","avatar_url":"https://secure.gravatar.com/avatar/b322f4dea8d0672f8bbd912f73d24a6d?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b322f4dea8d0672f8bbd912f73d24a6d"},"created_at":"2011-11-17T23:53:55Z","title":"Setting expires_after in session options causes sessions to always be persisted","state":"open","updated_at":"2011-12-18T00:02:34Z","labels":[],"id":2275361,"html_url":"https://github.com/rack/rack/issues/268","closed_at":null,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"It seems wrong that if expire_after is set this always causes sessions to be set.  Here's the relevant code from Rack::Session::Abstract::ID\r\n\r\n```\r\ndef force_options?(options)\r\n  options.values_at(:renew, :drop, :defer, :expire_after).any?\r\nend\r\n\r\ndef commit_session?(env, session, options)                                                                                                                                                                                                                                                                          \r\n  (loaded_session?(session) || force_options?(options)) && secure_session?(env, options)                                                                                                                                                                                                                            \r\nend   \r\n\r\n```\r\n\r\nIn my scenario, I have :expires_after set because I want sessions to expire after a certain amount of time.  But right now, setting this means that **every single request** will cause a session to be written, even if nothing was changed.  This is really bad if you are using memcache sessions, and have REST API callers that don't send session keys.  Basically, each API call will result in a new empty session which also gets stored in memcache.\r\n","number":268,"url":"https://api.github.com/repos/rack/rack/issues/268","comments":2,"assignee":null},"comment":{"user":{"id":348,"login":"raggi","url":"https://api.github.com/users/raggi","avatar_url":"https://secure.gravatar.com/avatar/b19b02a49b433c9e2e6e6c43785d2bfb?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b19b02a49b433c9e2e6e6c43785d2bfb"},"created_at":"2011-12-18T00:02:34Z","updated_at":"2011-12-18T00:02:34Z","id":3192329,"body":"How are you setting expire_after if you haven't setup a session yet? It seems like you only want to do that if you have a session you want to expire?","url":"https://api.github.com/repos/rack/rack/issues/comments/3192329"},"action":"created"}