Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Custom flush agent

Avatar

Level 1

Hi,

QUESTION

Is it possible to plug in a custom flush agent in AEM or somehow modify the behavior of the existing flush agent?

MOTIVATION

I am trying to find a neat way to solve the Dispatcher cache invalidation problem that occurs when using Sling mapping. When Sling mapping is used, the Dispatcher cache folder structure doesn't follow content hierarchy in the repository. Example:

  • URL: /us/<site>/page1.html  (cache folder hierarchy)
  • Repository: /content/<site>/en_US/page1  (content hierarchy)

When "page1" is activated, the flush agent requests invalidation of "/content/<site>/en_US/page1". The Dispatcher only knows about "/us/<site>/page1.html" so no cache invalidation is performed.

Most resources that I could find online recommends creating mod_rewrite rules in Apache that matches the mapping performed by Sling. This seems like a poor solution that requires duplication of logic and also requires that the configurations must be in synch.

IDEA

If it was possible to modify the behavior of the replication flush agent, one could use the mapping service (ResourceResolver?) to translate the resource path to the actual URL and then request invalidation of that path instead.

Please let me know your thought on this. We're using AEM 5.6.1. Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 8
1 Reply

Avatar

Correct answer by
Level 8