Skip to content

Commit 429108e

Browse files
Jan Adamsclaude
andcommitted
Document invalidate_dependencies configuration
Adds invalidate_dependencies to the full config reference in doc/2 and a dedicated section in doc/3 explaining the feature, its opt-in nature, the one-level-deep traversal, and example configs for objects, assets, and documents as sources. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fe5a489 commit 429108e

2 files changed

Lines changed: 81 additions & 5 deletions

File tree

doc/2-configuration.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,48 @@ neusta_pimcore_http_cache:
1111
types:
1212
archive: false
1313
unknown: false
14-
14+
15+
# Invalidate dependent elements when an asset changes (disabled by default)
16+
invalidate_dependencies:
17+
enabled: true
18+
types:
19+
objects: true
20+
documents: true
21+
1522
# Unless you disable assets completely
1623
enabled: false
17-
24+
1825
documents:
1926
# By default, every type except "email", "folder" and "hardlink" is enabled
2027
types:
2128
link: false
22-
29+
30+
# Invalidate dependent elements when a document changes (disabled by default)
31+
invalidate_dependencies:
32+
enabled: true
33+
types:
34+
objects: true
35+
2336
# Unless you disable documents completely
2437
enabled: false
25-
38+
2639
objects:
2740
# By default, every type except "folder" is enabled
2841
types:
2942
variant: false
30-
43+
3144
# By default, every data object class is enabled
3245
classes:
3346
MyDataObjectClass: false
3447

48+
# Invalidate dependent elements when an object changes (disabled by default)
49+
invalidate_dependencies:
50+
enabled: true
51+
types:
52+
objects: true
53+
documents: true
54+
assets: true
55+
3556
# Unless you disable data objects completely
3657
enabled: false
3758

doc/3-pimcore-elements.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,58 @@ neusta_pimcore_http_cache:
8181
classes:
8282
MyDataObjectClass: false
8383
```
84+
85+
## Dependent Element Invalidation
86+
87+
When a Pimcore element is updated or deleted, other elements that reference it may also serve stale content.
88+
For example, a document that embeds a data object will be outdated as soon as that object changes.
89+
90+
By default, the bundle only invalidates the cache tag of the element that was directly changed.
91+
Dependent element invalidation — traversing Pimcore's dependency graph to also purge referencing elements — is **disabled by default** and must be opted in via configuration.
92+
93+
The dependency graph is one level deep: only elements that directly reference the changed element are invalidated, not transitive dependencies.
94+
95+
### Enable dependent invalidation for objects
96+
97+
The most common use case is invalidating documents and other objects that reference a changed data object:
98+
99+
```yaml
100+
neusta_pimcore_http_cache:
101+
elements:
102+
objects:
103+
invalidate_dependencies:
104+
enabled: true
105+
types:
106+
documents: true # invalidate documents that reference the object
107+
objects: true # invalidate objects that reference the object
108+
assets: false # leave assets out (default)
109+
```
110+
111+
### Enable dependent invalidation for assets
112+
113+
If an asset (e.g. an image) is referenced by objects or documents, those can be invalidated when the asset changes:
114+
115+
```yaml
116+
neusta_pimcore_http_cache:
117+
elements:
118+
assets:
119+
invalidate_dependencies:
120+
enabled: true
121+
types:
122+
objects: true # invalidate objects that reference the asset
123+
documents: true # invalidate documents that reference the asset
124+
```
125+
126+
### Enable dependent invalidation for documents
127+
128+
If a document is referenced by other elements (e.g. an object with a document relation field), those elements can be invalidated when the document changes:
129+
130+
```yaml
131+
neusta_pimcore_http_cache:
132+
elements:
133+
documents:
134+
invalidate_dependencies:
135+
enabled: true
136+
types:
137+
objects: true # invalidate objects that reference the document
138+
```

0 commit comments

Comments
 (0)