Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Introducing Views Cache Bully: You're gonna cache your views, and you're gonna like it.

Parent Feed: 

views cache bully admin settingsTucked away under the Views UI's "advanced" fieldset is a too-seldom-used option: Views caching. It allows you to cache the query results and/or rendered markup for any given view. This can drastically improve your site's performance.

Unfortunately, many people don't use this option. Maybe they don't know about it, maybe they've forgotten about it, or maybe they don't like. Well, the Views Cache Bully module is here to say "Too bad. You're gonna cache your views, and you're gonna like it."

To quote Dave Stoline (dstol):

Views Cache Bully some serious assumptions about caching your views. It forces caching down your throat

How does it work?

This is pretty straightforward module. It works by setting the views_plugin_cache_none plugin to use the views_plugin_cache_time plugin. Once enabled, all of your site's uncached views will be using time-based caching. The settings for bully-enforced caching can be globally administered on a settings page, which requires the "administer views cache bully" permission. This will keep naughty content admins from trying to pull a quick one.

If you'd rather not use the globally set cache expirations, that's fine. You can still choose customized time-based caching per view—you just can't get away with no caching. Well, maybe you can.

Administrators with sufficient permissions may make exemptions for specific views. This is most important for views with exposed filters (which don't always play well with caching). By default, views that use exposed filters are exempt. This is a bully with a heart of gold.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web