Class: RedisSessionStore
- Inherits:
-
ActionController::Session::AbstractStore
- Object
- ActionController::Session::AbstractStore
- RedisSessionStore
- Defined in:
- lib/redis-session-store.rb
Overview
Redis session storage for Rails, and for Rails only. Derived from the MemCacheStore code, simply dropping in Redis instead.
Options:
:key => Same as with the other cookie stores, key name
:secret => Encryption secret for the key
:host => Redis host name, default is localhost
:port => Redis port, default is 6379
:db => Database number, defaults to 0. Useful to separate your session storage from other data
:key_prefix => Prefix for keys used in Redis, e.g. myapp-. Useful to separate session storage keys visibly from others
:expire_after => A number in seconds to set the timeout interval for the session. Will map directly to expiry in Redis
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ RedisSessionStore
constructor
A new instance of RedisSessionStore.
Constructor Details
#initialize(app, options = {}) ⇒ RedisSessionStore
Returns a new instance of RedisSessionStore.
17 18 19 20 21 22 23 24 25 |
# File 'lib/redis-session-store.rb', line 17 def initialize(app, = {}) super = {} @default_options.merge!(:namespace => 'rack:session') @default_options.merge!([:redis]) if [:redis] @redis = Redis.new() end |