I have a Neos (3.x) backend module and I’m wondering now how I can flush the cache of a Neos.Neos:Page NodeType in my PHP BackendController.
I have to keep the session and everything else. Only the cache for Page object should be flushed or marked as invalide so that the Page is build again from scratch.
The package Neos.Neos uses a signal/slot combination, whenever a node is changed/published/deleted/[whatever] and it seems to use a ContentCacheFlusher class located in Neos\Neos\Fusion\Cache\ContentCacheFlusher.
And it seems that you can pass a node to it - so you task is to use a nodedata repository and get all nodes of a specific type, and then iterate that collection and use the ContentCacheFlusher class.
Bonus info: The caches are defined inside Caches.yaml in the Neos.Neos package so you might find some luck there about the configuration.
SanitizeTag is a simple return strtr($tag, ‘.:’, ‘_-’); and $nodeType is the name of your NodeType.
This just builds the FlushTag just as you would use it in Fusion.
If you need to flush the cache if a node has changed go the way @sorenmalling described. We use something similar to send ban requests to varnish/nginx
If you need to persist your session cache btw you should mark it as persistent:
Flow_Session_MetaData:
persistent: TRUE