mdarby (owner)

Forks

Revisions

gist: 59951 Download_button fork
public
Public Clone URL: git://gist.github.com/59951.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if RAILS_ENV != 'development'
  require 'cache_money'
 
  config = YAML.load(IO.read(File.join(RAILS_ROOT, "config", "memcached.yml")))[RAILS_ENV]
  $memcache = MemCache.new(config)
  $memcache.servers = config['servers']
 
  $local = Cash::Local.new($memcache)
  $lock = Cash::Lock.new($memcache)
  $cache = Cash::Transactional.new($local, $lock)
 
  class ActiveRecord::Base
    is_cached :repository => $cache
  end
else
  # If we're in development mode, we don't want to
  # deal with caching oddities, so let's override
  # cache-money's #index method to do nothing...
  class ActiveRecord::Base
    def self.index(*args)
    end
  end
end