New Module: Flush Page Cache
I'm pleased to announce the beta release of a new Drupal module called Flush Page Cache. While it's an extremely useful utility module, I sometimes liken it to the age-old rituals of blowing on a Nintendo cartridge or hitting the side of the TV to get things working again. What it actually does is provide site administrators a handy button that flushes all of the caches for a single page. So if you have a panel that has a view that lists some nodes and you edit one of those nodes, this allows you to quickly and easily flush the cache for the panel page and see fresh content, rather than having to wait for the panel's cache to expire naturally. Operators of larger Drupal sites know that flushing the entire cache can feel like waiting on the tarmac at JFK.
Features
- Many button placement options including: in the page footer, with a block, or if you use the Administration Menu module, a link is included there as well.
- The ability to define specific cache objects to be cleared when flushing page caches.
- Varnish integration, which also purges the cached page from Varnish.
Sample Configurations
Of note is the second item mentioned above. In the configuration options for the module, you can define specific CIDs with wildcards for specific page paths, providing what is essentially a GUI for the cache_clear_all() function. You'll need to do a little bit of digging into the cache tables to see what CIDs to associate with which paths, but I've written up a few sample configurations that might convince you of its flexibility.
- If you want to clear all view caches for the "blog" view when you flush the cache at http://example.com/blog, add the following custom setting:
- Path = blog
- Cache ID = blog:
- Table = cache_views_data
- Wildcard = TRUE
- If you want to clear block 12's cache on all paths beginning with "about", add the following custom setting:
- Path = about/*
- Cache ID = block:12:
- Table = cache_block
- Wildcard = TRUE
- If you want to clear the entire page cache every time you flush a page's cache (this is a horrible idea, but it's possible) add the following custom setting:
- Path = *
- Cache ID = *
- Table = cache_page
- Wildcard = TRUE
Background
The original version of the module was developed by Jacob Rockowitz while I was unknowingly developing a similar module in parallel. I was pointed to his module by a coworker and decided to abandon my module in favor of combining forces with him because it was slightly more feature rich. Please direct any and all feedback in Flush Page Cache's issue queue.