Lazy require memcache for session middleware

This commit is contained in:
Joshua Peek 2009-09-13 15:30:55 -05:00
parent fff3f0ae0c
commit a01bf41c61
1 changed files with 37 additions and 42 deletions

View File

@ -1,11 +1,9 @@
require "active_support/core_ext/kernel/requires"
begin
require_library_or_gem 'memcache'
module ActionDispatch
module Session
class MemCacheStore < AbstractStore
def initialize(app, options = {})
require 'memcache'
# Support old :expires option
options[:expire_after] ||= options[:expires]
@ -47,6 +45,3 @@ begin
end
end
end
rescue LoadError
# MemCache wasn't available so neither can the store be
end