Class: ActionDispatch::Session::RedisSessionStore

Inherits:
AbstractStore
  • Object
show all
Defined in:
lib/redis_session_store.rb

Overview

: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

Constructor Details

#initialize(app, options = {}) ⇒ RedisSessionStore

Returns a new instance of RedisSessionStore.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/redis_session_store.rb', line 15

def initialize(app, options = {})
  # Support old :expires option
  options[:expire_after] ||= options[:expires]
  options[:key_prefix] ||= options[:key]

  super

  @default_options = {
    :namespace => 'rack:session',
    :host => 'localhost',
    :port => '6379',
    :db => 0,
    :key_prefix => ""
  }.update(options)

  @pool = Redis.new(@default_options)
end