Yesterday I released a new Rails plugin: cached_models.
It allows to transparently use the internal Rails cache mechanism in
your models, avoiding to write code for expiring policies.
class Project < ActiveRecord::Base
has_many :developers, :cached => true
class Developer < ActiveRecord::Base
belongs_to :project, :cached => true
# Automatic cache, all the following calls will be served by the cache.
developer = project.developers.first
developer.update_attributes :first_name => 'Luca'
# Database update and cache expiring for project.
project2.developers << developer
# Database update and cache expiring for project and project2
This is a 0.0.1 release, it actually support only the has_many relation.
BTW I'd really like to receive a lot of feedbacks and comments.
You can find all the documentation here: http://tinyurl.com/6e3mwk