Hi all,
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.
Example
class Project < ActiveRecord::Base
has_many :developers, :cached => true
end
class Developer < ActiveRecord::Base
belongs_to :project, :cached => true
end
Automatic cache, all the following calls will be served by the cache.
project.developers
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
Ciao,
-luca
blog: www.lucaguidi.com
Pro-Netics: www.pro-netics.com
Sourcesense - making sense of Open Source: www.sourcesense.com