You are here

function metatag_metatags_cache_clear in Metatag 7

Clear the cached records for a given entity type or entity ID.

Parameters

string $entity_type: The entity type to clear.

5 calls to metatag_metatags_cache_clear()
metatag_bulk_revert_batch_operation in ./metatag.admin.inc
Batch callback: delete custom metatags for selected bundles.
metatag_entity_update in ./metatag.module
Implements hook_entity_update().
metatag_metatags_delete_multiple in ./metatag.module
Delete multiple entities' tags.
metatag_metatags_save in ./metatag.module
Save an entity's tags.
metatag_workbench_moderation_transition in ./metatag.module
Implements hook_workbench_moderation_transition().

File

./metatag.module, line 925
Primary hook implementations for Metatag.

Code

function metatag_metatags_cache_clear($entity_type, $entity_ids = NULL) {
  if (empty($entity_ids)) {
    cache_clear_all("output:{$entity_type}", 'cache_metatag', TRUE);
  }
  else {
    if (!is_array($entity_ids)) {
      $entity_ids = array(
        $entity_ids,
      );
    }
    foreach ($entity_ids as $entity_id) {
      cache_clear_all("output:{$entity_type}:{$entity_id}", 'cache_metatag');
    }
  }
}