public DatabaseCacheTagsChecksum::invalidateTags(array $tags)
Marks cache items with any of the specified tags as invalid.
Parameters
string[] $tags: The list of tags for which to invalidate cache items.
Overrides CacheTagsInvalidatorInterface::invalidateTags
File
- core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php, line 49
Class
- DatabaseCacheTagsChecksum
- Cache tags invalidations checksum implementation that uses the database.
Namespace
Drupal\Core\Cache
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | public function invalidateTags( array $tags ) { try { foreach ( $tags as $tag ) { // Only invalidate tags once per request unless they are written again. if (isset( $this ->invalidatedTags[ $tag ])) { continue ; } $this ->invalidatedTags[ $tag ] = TRUE; unset( $this ->tagCache[ $tag ]); $this ->connection->merge( 'cachetags' ) ->insertFields( array ( 'invalidations' => 1)) ->expression( 'invalidations' , 'invalidations + 1' ) ->key( 'tag' , $tag ) ->execute(); } } catch (\Exception $e ) { // Create the cache table, which will be empty. This fixes cases during // core install where cache tags are invalidated before the table is // created. if (! $this ->ensureTableExists()) { $this ->catchException( $e ); } } } |
Please login to continue.