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
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