Class: MemCachedSessionStore
- Inherits:
-
ActionController::Session::AbstractStore
- Object
- ActionController::Session::AbstractStore
- MemCachedSessionStore
- Defined in:
- lib/mem_cached_session_store.rb
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ MemCachedSessionStore
constructor
A new instance of MemCachedSessionStore.
Constructor Details
#initialize(app, options = {}) ⇒ MemCachedSessionStore
Returns a new instance of MemCachedSessionStore.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mem_cached_session_store.rb', line 5 def initialize(app, = {}) # Support old :expires option [:expire_after] ||= [:expires] super @default_options = { :namespace => 'rack:session', :servers => 'localhost:11211' }.merge(@default_options) @default_options[:prefix_key] ||= @default_options[:namespace] @pool = [:cache] || Memcached.new(@default_options[:servers], @default_options) # unless @pool.servers.any? { |s| s.alive? } # raise "#{self} unable to find server during initialization." # end @mutex = Mutex.new super end |