public
Description: Observes DataMapper models and expires Merb caches on changes
Homepage: http://redflavor.com
Clone URL: git://github.com/uggedal/merb_cache_observer.git
uggedal (author)
Wed Jul 30 05:08:05 -0700 2008
commit  35f69f630a90dc19af3ec21a4f329d17a85bd152
tree    216b52eade65f06ce672a096dd513efa5acabb8b
parent  37965893d3a176d8875845e92851e1b1f7dde74c
name age message
file .gitignore Loading commit data...
file LICENSE
file README.markdown
file Rakefile
directory lib/
directory spec/
README.markdown

Merb cache observer

A plugin for the Merb framework that provides easy integration of model observers for DataMapper which will expire caches. Based on Cache watch by nutrun.

Works on page caches for now. The cache is expired when the provided model class is saved or destroyed.

Imagine we have a People controller with an index page shortly listing all people in the system. The show page lists detailed account information for any person. We then want to invalidate the page cache for the index page when the person model is changed.

class People < Merb::Controller
  cache_pages :index, :show
  observe_pages [:index, Person], [:show, Person, Account]
end

There is also a singular counterpart to cache_page:

class Entries < Merb::Controller
  cache_page :index
  observe_page :index, Entry, Comment
end