Skip to content

Instantly share code, notes, and snippets.

@shadowmaru
Created August 23, 2009 22:54
Show Gist options
  • Save shadowmaru/173507 to your computer and use it in GitHub Desktop.
Save shadowmaru/173507 to your computer and use it in GitHub Desktop.
class PageSweeper < ActionController::Caching::Sweeper
observe Page
def after_save(page)
clear_page_cache
end
def after_destroy(page)
clear_page_cache
end
def clear_page_cache
expire_page('/index')
dirs = %w{ pages news }
sweep_directory(dirs)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment