mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge branch 'master' of github.com:rails/docrails
This commit is contained in:
commit
dcfd4bf223
3 changed files with 20 additions and 3 deletions
|
@ -2,12 +2,15 @@ require 'action_dispatch/middleware/session/abstract_store'
|
|||
|
||||
module ActionDispatch
|
||||
module Session
|
||||
# Session store that uses an ActiveSupport::Cache::Store to store the sessions. This store is most useful
|
||||
# A session store that uses an ActiveSupport::Cache::Store to store the sessions. This store is most useful
|
||||
# if you don't store critical data in your sessions and you don't need them to live for extended periods
|
||||
# of time.
|
||||
#
|
||||
# ==== Options
|
||||
# * <tt>cache</tt> - The cache to use. If it is not specified, <tt>Rails.cache</tt> will be used.
|
||||
# * <tt>expire_after</tt> - The length of time a session will be stored before automatically expiring.
|
||||
# By default, the <tt>:expires_in</tt> option of the cache is used.
|
||||
class CacheStore < AbstractStore
|
||||
# Create a new store. The cache to use can be passed in the <tt>:cache</tt> option. If it is
|
||||
# not specified, <tt>Rails.cache</tt> will be used.
|
||||
def initialize(app, options = {})
|
||||
@cache = options[:cache] || Rails.cache
|
||||
options[:expire_after] ||= @cache.options[:expires_in]
|
||||
|
|
|
@ -52,6 +52,16 @@ module ActionDispatch
|
|||
# JavaScript before upgrading.
|
||||
#
|
||||
# Note that changing the secret key will invalidate all existing sessions!
|
||||
#
|
||||
# Because CookieStore extends Rack::Session::Abstract::ID, many of the
|
||||
# options described there can be used to customize the session cookie that
|
||||
# is generated. For example:
|
||||
#
|
||||
# Rails.application.config.session_store :cookie_store, expire_after: 14.days
|
||||
#
|
||||
# would set the session cookie to expire automatically 14 days after creation.
|
||||
# Other useful options include <tt>:key</tt>, <tt>:secure</tt> and
|
||||
# <tt>:httponly</tt>.
|
||||
class CookieStore < Rack::Session::Abstract::ID
|
||||
include Compatibility
|
||||
include StaleSessionCheck
|
||||
|
|
|
@ -8,6 +8,10 @@ end
|
|||
|
||||
module ActionDispatch
|
||||
module Session
|
||||
# A session store that uses MemCache to implement storage.
|
||||
#
|
||||
# ==== Options
|
||||
# * <tt>expire_after</tt> - The length of time a session will be stored before automatically expiring.
|
||||
class MemCacheStore < Rack::Session::Dalli
|
||||
include Compatibility
|
||||
include StaleSessionCheck
|
||||
|
|
Loading…
Reference in a new issue