function entitycache_entity_update

cis7 entitycache.module entitycache_entity_update($entity, $type)
cle7 entitycache.module entitycache_entity_update($entity, $type)
elmsmedia7 entitycache.module entitycache_entity_update($entity, $type)
icor7 entitycache.module entitycache_entity_update($entity, $type)
meedjum_blog7 entitycache.module entitycache_entity_update($entity, $type)
mooc7 entitycache.module entitycache_entity_update($entity, $type)

Implements hook_entity_update().

File

sites/all/modules/ulmus/entitycache/entitycache.module, line 300
Allows for caching of core entities.

Code

function entitycache_entity_update($entity, $type) {
  // It is possible for other _update() hooks to load an entity before it has
  // been properly saved, for example file_field_update(). This may cause
  // an incomplete entity to be cached, since hooks which run after the one
  // loading the entity do not have a chance to run. Therefore ensure the cache
  // is always cleared when updating entities.
  // Since hook_entity_insert() runs last, there's a good chance of acting
  // after other modules are finished loading.
  $info = entity_get_info($type);
  list($id) = entity_extract_ids($type, $entity);
  if (!empty($info['entity cache']) && empty($entity->migrate)) {
    cache_clear_all($id, 'cache_entity_' . $type);
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.