5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rack::Session::Dalliのexpire_afterには要注意

Posted at

Rack::Session::Dalliは、Rack::Session::Memcacheの代わりに使える素敵なモジュールです。

Rack::Session::Dalliに指定するexpire_afterの最大値は2591999 (60 * 60 * 24 * 30 - 1)です。これを超えた値を指定すると、memcachedに値が保存されずに即座にexpireしてしまうようです。例外も何も出ないので注意が必要。

class MyApp < Sinatra::Base
  use Rack::Session::Dalli,
    memcache_server: 'localhost:11211',
    domain: 'mydomain.com',
    path: '/',
    expire_after: 60 * 60 * 24 * 30 - 1  # 2592000未満の値にしよう!
  # (略)
end
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?