You are here

function cache_actions_rules_cache_clear_cache in Cache Actions 7

Same name and namespace in other branches
  1. 6.2 plugins/cache/rules.inc \cache_actions_rules_cache_clear_cache()
  2. 7.2 plugins/cache/rules.inc \cache_actions_rules_cache_clear_cache()

Clear cached content.

Parameters

$display the display object. If this object has a property named: clear_pane, then that pane will be cleared.

1 string reference to 'cache_actions_rules_cache_clear_cache'
rules.inc in plugins/cache/rules.inc
Provides a simple time-based caching option for panel panes.

File

plugins/cache/rules.inc, line 50
Provides a simple time-based caching option for panel panes.

Code

function cache_actions_rules_cache_clear_cache($display) {
  $cid = 'rc';

  // Add some text if this is a pane, so that we don't clear all panes when
  // we clear a panel pane.
  if (isset($display->clear_pane)) {
    $cid .= ':p';
  }
  if (is_numeric($display->did) && $display->did) {
    $cid .= ':' . $display->did;
  }
  else {

    // Add the cache key if this is an in-code display.
    $cid .= ':' . $display->cache_key;
  }

  // If this is a mini panel then we have the owner property. Let's
  // use the machine name for those.
  if (isset($display->owner->name)) {
    $cid .= ':' . $display->owner->name;
  }

  // If we have a pane specified, then append that to the key as well.
  if (isset($display->clear_pane)) {
    $cid .= ':' . $display->clear_pane->pid;
  }
  cache_clear_all($cid, 'cache', TRUE);
}