As you can read, I need the Cache Module to reduce Database queries, but my frontpages makes use of various Scripts that are dynamically loaded and have other caching solutions.

So how can i prevent the frontpage from beeing cached?
The CacheExclude Module for Drupal is very basic and works only for Subpages and not for the frontpage...

Anybody knows a possible solution?

Comments

pobster’s picture

Just change line 46 to;

if ($page && strstr($this_page, $page) !== false || ($page == '<front>' && drupal_is_front_page())) {

Then (obviously) use <front> to reference the frontpage in your cacheexclude settings.

Pobster

Rahner’s picture

Thank your for this addition, do you know how I can now test, if all nodes are cached and the frontpage not?

pobster’s picture

I tested it, it works - to see it working try doing this;

/**
 * Implementation of hook_exit().
 */
function cacheexclude_exit($destination = NULL) {
  global $base_root;

  if ($destination == NULL) {
    $pages = trim(variable_get('cacheexclude_list', ''));
    if (strlen($pages) == 0) {
      return;
    }
    else {
      $pages = explode("\n", variable_get('cacheexclude_list', ''));
      $this_page = request_uri();
      foreach ($pages as $page) {
        $page = trim($page);
        if ($page && strstr($this_page, $page) !== false ) {  // Obviously add the change here
print "yes I work...";
          cache_clear_all($base_root . $this_page, 'cache_page');
          return;
        }
      }
    }
  }
}

Then you'll see the message returned AT THE BOTTOM OF THE PAGE (as it's called on hook_exit) upon successful pick up.

Pobster

Rahner’s picture

Thank you pobster!