CacheTagInvalidator
in package
Invalidates tag versions after the commit; fail-open.
Runs outside the transaction and must not break data that is already saved (an exception only goes to the log).
bumpFor() and bumpForClass() increment the tag of the class plus the classes of its owned
cascade collections (from Doctrine metadata: saving or deleting a parent must invalidate
lists of inlined children too) plus optional $extraTags (e.g. additionalCacheTags() of
a manager: Comment bumps CommentThread because of the comment_count database trigger).
bumpTag() and bumpTags() bump explicit classes (raw-DBAL paths, deleteAll(), tree
deletes), which bypass the completed hooks.
Table of Contents
Properties
- $em : EntityManagerInterface
- $stats : CacheStats|null
- $tagVersions : TagVersions
Methods
- __construct() : mixed
- bumpFor() : void
- bumpForClass() : void
- bumpTag() : void
- bumpTags() : void
- ownedCascadeClasses() : array<string|int, string>
- Returns the root class plus the classes of its owned collections (cascade persist/remove or orphan removal). They are inlined in the cached parent graph, so writing the parent must bump their list tags too.
Properties
$em read-only
private
EntityManagerInterface
$em
$stats read-only
private
CacheStats|null
$stats
= null
$tagVersions read-only
private
TagVersions
$tagVersions
Methods
__construct()
public
__construct(TagVersions $tagVersions, EntityManagerInterface $em[, CacheStats|null $stats = null ]) : mixed
Parameters
- $tagVersions : TagVersions
- $em : EntityManagerInterface
- $stats : CacheStats|null = null
bumpFor()
public
bumpFor(object $entity[, array<string|int, string> $extraTags = [] ]) : void
Parameters
- $entity : object
- $extraTags : array<string|int, string> = []
-
extra tag FQCNs (e.g. from
additionalCacheTags())
bumpForClass()
public
bumpForClass(class-string $rootClass[, array<string|int, string> $extraTags = [] ]) : void
Parameters
- $rootClass : class-string
- $extraTags : array<string|int, string> = []
bumpTag()
public
bumpTag(string $class) : void
Parameters
- $class : string
bumpTags()
public
bumpTags(array<string|int, string> $classes) : void
Parameters
- $classes : array<string|int, string>
ownedCascadeClasses()
Returns the root class plus the classes of its owned collections (cascade persist/remove or orphan removal). They are inlined in the cached parent graph, so writing the parent must bump their list tags too.
private
ownedCascadeClasses(class-string $rootClass) : array<string|int, string>
Parameters
- $rootClass : class-string