diff options
Diffstat (limited to 'actionpack/lib/action_controller/session/mem_cache_store.rb')
-rw-r--r-- | actionpack/lib/action_controller/session/mem_cache_store.rb | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/actionpack/lib/action_controller/session/mem_cache_store.rb b/actionpack/lib/action_controller/session/mem_cache_store.rb deleted file mode 100644 index f745715a97..0000000000 --- a/actionpack/lib/action_controller/session/mem_cache_store.rb +++ /dev/null @@ -1,51 +0,0 @@ -begin - require_library_or_gem 'memcache' - - module ActionController - module Session - class MemCacheStore < AbstractStore - def initialize(app, options = {}) - # Support old :expires option - options[:expire_after] ||= options[:expires] - - super - - @default_options = { - :namespace => 'rack:session', - :memcache_server => 'localhost:11211' - }.merge(@default_options) - - @pool = options[:cache] || MemCache.new(@default_options[:memcache_server], @default_options) - unless @pool.servers.any? { |s| s.alive? } - raise "#{self} unable to find server during initialization." - end - @mutex = Mutex.new - - super - end - - private - def get_session(env, sid) - sid ||= generate_sid - begin - session = @pool.get(sid) || {} - rescue MemCache::MemCacheError, Errno::ECONNREFUSED - session = {} - end - [sid, session] - end - - def set_session(env, sid, session_data) - options = env['rack.session.options'] - expiry = options[:expire_after] || 0 - @pool.set(sid, session_data, expiry) - return true - rescue MemCache::MemCacheError, Errno::ECONNREFUSED - return false - end - end - end - end -rescue LoadError - # MemCache wasn't available so neither can the store be -end |