caching

Disable Drupal's page cache for some pages

We all know our Drupal sites can gain a huge performance boost by enabling page caching. But sometimes, you want to exclude certain pages from being cached.

One option to do such a thing is using a small module called CacheExclude.

You might also opt to program this yourself in your own modules by setting the cache variable to FALSE. Variables can be set temporarily for the current request by setting the global array conf.

A small example might clarify things. We're disabling caching on the front page here (not a thing you'd like to do every day, but it's an example ;)).

if (drupal_is_front_page()) {
  $GLOBALS['conf']['cache'] = FALSE;
}
Written on November 12, 2008 at 19:56, tagged as caching, Drupal, module development

Moving a Drupal site with page caching enabled

Quick note to people who have page caching on on their site:

If you move your site to a new url, don't forget to flush your cache_page table after moving the site since Drupal uses the full url (including the domain name etc.) as the cache key.

Written on October 10, 2008 at 22:44, tagged as caching, Drupal, things you might have overlooked, tips

About

drupalcoder.com is a blog on all things Drupal in specific and LAMP on OS X in general. It is maintained by Davy Van Den Bremt, a Belgian (Drupal) web developer and designer living in Ghent. The goal of this blog is to log all interesting things that have crossed the writer's path while developing Drupal sites. You can read all about Davy's professional activities on his LinkedIn profile. If you want to get in touch, use the contact form.