- no clear cache button
- 100 % transparent for editors
- good caching makes sites fast
We are forced to configure caching right as otherwise editors will complain
https://docs.neos.io/cms/manual/rendering/caching
- Fusion has a static syntax tree and each branch can evaluated seperately for a specific context
- Same path and context should result in the same value.
- The results of each branch/leave can be cached (for a given set of identifiers)
- When evaluating any branch fusion checks first wether there is a cache entry alredy
- Cached entries
- Value for the fusion path
- Can have a due date (may be 0)
- Can have tags to mark when they are be thrown away before the due date
- !!! Fusion cache entries are always strings !!!
embed... into parent cache entrycached... controlmaximumLifetime,entryIdentifier(find entry again),entryTags(when to delete)uncached... controlcontextas only those values will be available for partial reevaluationdynamic... controlentryDiscriminatorfalse >> likeuncached, "strings" >> multiplecachedfragments
${Neos.Caching.nodeTypeTag('[My.Package:NodeTypeName]', node)}: Flushes cache entries if any node with the given node type changes.${Neos.Caching.nodeTag(node)}: Flushes cache entries if the node changes${Neos.Caching.descendantOfTag(node)}: Flushes cache entries if a child node of the node changes.- "anyStringCanBeUsedAsTag" : You have to ensure calling flushByTag for this cache-tag yourself via signal, aspect etc.
root {
#
# render the fusion prototype that is named like the document type
#
@cache {
mode = 'cached'
entryIdentifier {
node = ${node}
}
entryTags {
# Whenever the node changes the matched condition could change
1 = ${Neos.Caching.nodeTag(documentNode)}
# Whenever one of the parent nodes changes the layout could change
2 = ${Neos.Caching.nodeTag(q(documentNode).parents())}
}
}
}
prototype(Neos.Neos:ContentCollection) < prototype(Neos.Fusion:Tag) {
#
# rendering of content collection
#
@cache {
mode = 'cached'
entryIdentifier {
collection = ${node}
}
entryTags {
1 = ${Neos.Caching.descendantOfTag(node)}
2 = ${Neos.Caching.nodeTag(node)}
}
maximumLifetime = ${q(node).context({'invisibleContentShown': true}).children().cacheLifetime()}
}
@exceptionHandler = 'Neos\\Neos\\Fusion\\ExceptionHandlers\\NodeWrappingHandler'
}
#
# no caching for nested collections
#
prototype(Neos.Neos:ContentCollection) {
prototype(Neos.Neos:ContentCollection) {
@cache {
mode = 'embed'
}
}
}
Quelle: Neos.Neos:ContentCollection
prototype(Neos.Fusion:GlobalCacheIdentifiers) {
workspaceChain = ${documentNode.context.workspace.name + ',' + Array.join(Array.keys(documentNode.context.workspace.baseWorkspaces), ',')}
editPreviewMode = ${documentNode.context.currentRenderingMode.name}
}
- Avoid unneded cache fragmentation
- Cache things across pages when possible
- Try editing
- t3n/neos-debug https://github.com/t3n/neos-debug