Created
July 29, 2009 04:32
-
-
Save fredjean/157871 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
if RUBY_PLATFORM =~ /java/i | |
# Based on instructions 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 path is at the front of the loadpath | |
$LOAD_PATH.each do |path| | |
if path =~ /jruby-memcache-client/ | |
$LOAD_PATH.delete(path) | |
$LOAD_PATH.unshift(path) | |
end | |
end | |
# 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 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment