public
Fork of defunkt/cache_fu
Description: Everyone's favorite memcached plugin for ActiveRecord.
Homepage: http://errtheblog.com
Clone URL: git://github.com/technoweenie/cache_fu.git
cache_fu / init.rb
100644 28 lines (21 sloc) 0.726 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require 'memcache'
puts "=> You should be using the `memcache-client' gem. You're using RubyMemcache!" if Object.const_defined?(:RubyMemcache)
 
begin
  require 'mem_cache_with_consistent_hashing'
rescue LoadError
else
  puts "=> MemCacheWithConsistentHashing being used."
end
 
require 'acts_as_cached'
 
Object.send :include, ActsAsCached::Mixin
 
unless File.exists? config_file = File.join(RAILS_ROOT, 'config', 'memcached.yml')
  error = "No config file found. Make sure you used `script/plugin install' and have memcached.yml in your config directory."
  puts error
  logger.error error
  exit!
end
 
ActsAsCached.config = YAML.load(ERB.new(IO.read(config_file)).result)
 
begin
  require 'extensions'
rescue LoadError
end