protected Entity::invalidateTagsOnSave($update)
Invalidates an entity's cache tags upon save.
bool $update: TRUE if the entity has been updated, or FALSE if it has been inserted.
protected function invalidateTagsOnSave($update) { // An entity was created or updated: invalidate its list cache tags. (An // updated entity may start to appear in a listing because it now meets that // listing's filtering requirements. A newly created entity may start to // appear in listings because it did not exist before.) $tags = $this->getEntityType()->getListCacheTags(); if ($this->hasLinkTemplate('canonical')) { // Creating or updating an entity may change a cached 403 or 404 response. $tags = Cache::mergeTags($tags, ['4xx-response']); } if ($update) { // An existing entity was updated, also invalidate its unique cache tag. $tags = Cache::mergeTags($tags, $this->getCacheTagsToInvalidate()); } Cache::invalidateTags($tags); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Entity.php/function/Entity::invalidateTagsOnSave/8.1.x