How to I dynamically set the expiry time for a cookie-based session in Rails

前端 未结 6 616
失恋的感觉
失恋的感觉 2021-02-02 01:32

I\'m currently using the ActiveRecord-based session store for my Rails app and I have a background process which clears out inactive sessions every 30 minutes.

I\'d like

6条回答
  •  旧巷少年郎
    2021-02-02 01:39

    The session options page on the Rails wiki hints that this is only possible through a plugin:


    Set the session cookie expire time

    Unfortunately Rails has no way to dynamically set the expiry time of the session cookie. So it is recommended that you use the following plugin, which allows you to accomplish it: http://blog.codahale.com/2006/04/08/dynamic-session-expiration-times-with-rails/


    Of course take into account that the plugin is old, and may not work with your current version of Rails (I haven't looked at the specifics)

提交回复
热议问题