RecordCache

RecordCache is a simple yet powerful extension to ActiveRecord that caches indexes and ActiveRecord models using MemCache. If you use it correctly, it will drastically reduce your database load.

Usage:

class Foo < ActiveRecord
  record_cache :by => :id
  record_cache :id, :by => :owner_id
end

# These will use the cache now.
Foo.find(1)
Foo.find_by_id(2)
Foo.find_all_by_owner_id(3)

Invalidation is handled for you using callbacks.

Install:

First, install the after_commit plugin from: github.com/ninjudd/after_commit

Then install the following gems:

sudo gem install ninjudd-deferrable -s http://gems.github.com
sudo gem install ninjudd-ordered_set -s http://gems.github.com
sudo gem install ninjudd-memcache -s http://gems.github.com
sudo gem install ninjudd-cache_version -s http://gems.github.com
sudo gem install ninjudd-record_cache -s http://gems.github.com

License:

Copyright © 2009 Justin Balthrop, Geni.com; Published under The MIT License, see LICENSE