How to flush particular cached files when resource are replicated


The ACS-AEM-COMMONS package includes a lot of usefull features. One of this is the dispatcher flush rules. It allows to flush dispatcher cached files when resources are replicated.

The following example will show you how to flush the path /content/myapp when we replicate the i18n dictionnary under /apps/myapp/i18n.

Over all

You have to install the ACS-AEM-COMMONS package wich you can download here.

OSGI configuration

First of all, you need to create an OSGI configuration file under your /apps/myapp/config/ folder wich must be named :

<simpledescription> can be changed at your own convenience. In example :

Take care to properly suffix your file with .config ! In my case, .xml did not work 🙁

Configuration content

Your configuration file must contain the following lines :

Explanation :

  • prop.rules.hierarchical : We want to flush all pages under /content/myapp/ when /apps/myapp/i18n is replicated. The character egal (“=”) is the delimiter. You can also use regexp to define your mapping (Please find more examples here) :
  • prop.replication-action-type : We want to delete the cached files. You can also use INHERIT or ACTIVATE (Please find more examples here)

That’s it ! When your configuration is created, you can try to replicate the i18n dictionnary. AEM must fire a replicate request and a flush request.

The previous configuration works with author and publish flushing agent. In the second case, you just need to put your osgi configuration file on the publish instance.

Leave a Reply