You are here

public static function EntityCacheControllerHelper::resetEntityCache in Entity cache 7

6 calls to EntityCacheControllerHelper::resetEntityCache()
EntityCacheCommentController::resetCache in includes/entitycache.comment.inc
Implements DrupalEntityControllerInterface::resetCache().
EntityCacheDefaultEntityController::resetCache in includes/entitycache.defaultentitycontroller.inc
Implements DrupalEntityControllerInterface::resetCache().
EntityCacheNodeController::resetCache in includes/entitycache.node.inc
Implements DrupalEntityControllerInterface::resetCache().
EntityCacheTaxonomyTermController::resetCache in includes/entitycache.taxonomy.inc
Implements DrupalEntityControllerInterface::resetCache().
EntityCacheTaxonomyVocabularyController::resetCache in includes/entitycache.taxonomy.inc
Implements DrupalEntityControllerInterface::resetCache().

... See full list

File

includes/entitycache.entitycachecontrollerhelper.inc, line 16
EntityCacheControllerHelper cache helper.

Class

EntityCacheControllerHelper
Entity cache helper.

Code

public static function resetEntityCache($controller, array $ids = NULL) {
  drupal_alter('entitycache_pre_reset_cache', $ids, $controller->entityType);

  // Allow other modules to disable this cache clear, which is useful if
  // hook_entitycache_pre_cache_get() and hook_entitycache_pre_cache_set()
  // are used to prevent items to enter the cache.
  if ($ids === FALSE) {
    return;
  }

  // Reset the persistent cache.
  if (!empty($ids)) {
    cache_clear_all($ids, 'cache_entity_' . $controller->entityType);
  }
  else {

    // Force all cached entries to be deleted.
    cache_clear_all('*', 'cache_entity_' . $controller->entityType, TRUE);
  }

  // Give modules the chance to act on any entity.
  foreach (module_implements('entitycache_reset') as $module) {
    $function = $module . '_entitycache_reset';
    $function($ids, $controller->entityType);
  }

  // Give modules the chance to act on a specific entity type.
  foreach (module_implements('entitycache_' . $controller->entityType . '_reset') as $module) {
    $function = $module . '_entitycache_' . $controller->entityType . '_reset';
    $function($ids);
  }
}