You are here

function display_cache_flush_cache in Display Cache 7

Flushes the display cache of a given element.

If one argument is missing, all following arguments will be replaced with a wildcard.

Parameters

string $entity_type: Type like 'node' or 'comment'.

int|object $entity: (optional) Entity object or entity id. Leave empty to flush all entities of given type.

string $view_mode: (optional) View mode like 'full' or 'teaser'. Leave empty to flush all view modes of given entity.

string $element: (optional) Element like 'entity', 'field' or 'render_array'.

3 calls to display_cache_flush_cache()
display_cache_clear_comment_host_entity_cache in ./display_cache.module
Clears the given comments' host entity if needed.
display_cache_entity_delete in ./display_cache.module
Implements hook_entity_delete().
display_cache_entity_update in ./display_cache.module
Implements hook_entity_update().

File

./display_cache.module, line 183
Module file for Display Cache.

Code

function display_cache_flush_cache($entity_type, $entity = NULL, $view_mode = NULL, $element = NULL) {
  if (is_object($entity)) {
    $entity = entity_id($entity_type, $entity);
  }
  $keys = display_cache_get_cache_keys($entity_type, $entity, $view_mode, $element);
  $cache_id = implode(':', $keys) . ':';
  cache_clear_all($cache_id, DISPLAY_CACHE_CACHE_BIN, TRUE);
}