Skip to content

Instantly share code, notes, and snippets.

@ogasyo
Created August 2, 2013 08:49
Show Gist options
  • Save ogasyo/6138436 to your computer and use it in GitHub Desktop.
Save ogasyo/6138436 to your computer and use it in GitHub Desktop.
Rails4 で dalli が標準の MemcacheClient になっちゃった対策。
# Add legacy memcache session store for using KyotoTycoon with memcached protocol.
# Sourced from Rails 3.2
# => https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
#
require 'action_dispatch/middleware/session/abstract_store'
require 'rack/session/memcache'
module ActionDispatch
module Session
class LegacyMemCacheStore < Rack::Session::Memcache
include Compatibility
include StaleSessionCheck
include SessionObject
def initialize(app, options = {})
require 'memcache'
options[:expire_after] ||= options[:expires]
super
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment