Skip to content

Instantly share code, notes, and snippets.

@subelsky
Created July 27, 2009 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subelsky/156741 to your computer and use it in GitHub Desktop.
Save subelsky/156741 to your computer and use it in GitHub Desktop.
# modified from http://www.mikeperham.com/2009/03/03/using-memcache-client-16x-in-rails-23
# Brain surgery to use our own version of memcache-client without having to modify activesupport directly.
# Unload any previous instance of the class
if Object.const_defined? :MemCache
Object.instance_eval { remove_const :MemCache }
end
# Ensure that the memcache-client gem path is at the front of the loadpath
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/gems/memcache-client-1.7.4/lib')
# If Ruby thinks it's already loaded memcache.rb, force a reload otherwise just require.
if $".find { |file| file =~ /\Amemcache.rb\Z/ }
load 'memcache.rb'
else
require 'memcache'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment