Created
July 27, 2009 21:15
-
-
Save subelsky/156741 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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