flush-cache-in-aem-as-a-cloud-service-using-acs-commons-dispatcher-flush-rules.png

How to flush Cache using ACS commons dispatcher flush rule in AEM as a Cloud Service

May 16th | Atik Mujawar

Maintaining a high-performing Adobe Experience Manager (AEM) website requires effective cache management. In AEM as a Cloud Service (AEMaaCS), caching is typically handled at the Dispatcher layer. However, traditional flush agents are not supported in this cloud-native setup. That’s where ACS Commons Dispatcher Flush Rules become invaluable.

In this article, we’ll explore how to configure and use these rules to selectively flush the Dispatcher cache based on specific content updates—giving you precision control in a scalable cloud environment.



What is ACS Commons dispatcher flush rule?

The Dispatcher Flush Rule in ACS AEM Commons allows you to configure publish-side content changes to trigger specific cache flush paths at the Dispatcher.

This is especially useful in AEM as a Cloud Service where replication agents are not available, and content deployments or updates must trigger flushes in a decoupled and cloud-friendly way.



How does the ACS dispatcher flush rule work?

When a content change is made (e.g., page or assets activation or deactivation), a distributed event from Sling Distribution is cached and used to execute the Dispatcher Flush Rules



Steps to Configure ACS Commons Dispatcher Flush Rule

1. Install ACS Commons

Ensure your AEM environment has ACS AEM Commons installed. For AEM as a Cloud Service, include it in your project's all module dependencies.


<dependency>
  	<groupId>com.adobe.acs</groupId>
  	<artifactId>acs-aem-commons-content</artifactId>
  	<version>x.y.z</version> <!-- use the latest version -->
<type>zip</type>
<classifier>cloud</classifier>
</dependency>

2. Create a dispatcher flush rule configuration

Create an OSGi config file in your codebase under:


/apps//osgiconfig/config.author

Name the file:


com.adobe.acs.commons.replication.dispatcher.impl.DispatcherFlushRulesImpl~.cfg.json

Here's an example configuration in .json format:


{
   "prop.replication-action-type": "ACTIVATE",
   "prop.rules.hierarchical": [
 "/content/dam/mysite/us/en/content-fragments/sponsors/.*=/content/mysite/us/en/sponsers-list-page"       
   ]
}

  • Replication Types:
    • INHERIT: Use the action type of the origin replication
    • ACTIVATE: Invalidates the cached files opposed to deleting
    • DELETE: Deletes the cached files opposed to invalidating
  • The key-value pair maps source paths (like a folder of content fragments) to target pages whose cache should be flushed.

This configuration tells AEM: "When this path is activated, call these endpoints to flush the cache."



Real-world use case: Flushing cache for a dynamic page

Imagine a Sponsors List Page that dynamically pulls data from a set of content fragments. If one of those fragments is updated, you want the associated page's cache to be flushed.

With the configuration above:

  • When a content fragment under /content/dam/mysite/us/en/content-fragments/sponsors/ is activated,
  • A flush is triggered for /content/mysite/us/en/sponsors-list-page.

This ensures end users always see the latest content—without flushing unrelated pages or sections.



Benefits of using ACS commons dispatcher flush rules in AEM Cloud


  • Flushes only what you configure—fine-grained control
  • Easily extendable and configurable

Conclusion

The ACS Commons Dispatcher Flush Rule is a powerful tool for managing Dispatcher cache in AEM as a Cloud Service. It allows you to configure cache flushing intelligently and ensures your site stays fresh—without flushing everything.

Whether you're updating a page, rolling out new content, or running A/B tests, this approach gives you the control and flexibility you need in a cloud-native AEM setup.

If you're looking to implement ACS Commons Dispatcher Flush Rules or need expert guidance with your AEM Cloud projects, feel free to reach out to us. Our team of Adobe Experience Manager specialists is here to help you build faster, smarter, and more scalable digital experiences.