How to clear author dispatcher cache when we enableTTL? | Community
Skip to main content
Abhishek_Narula25
Level 3
December 7, 2023
Solved

How to clear author dispatcher cache when we enableTTL?

  • December 7, 2023
  • 3 replies
  • 1807 views

We are enabling dispatcher caching on author (AEM 6.5 AMS). We have set enableTTL as 1. Caching is working fine for us. But the issue comes when we need to clear the cache on demand.

We are using ACS AEM Commons Dispatcher Cache Control Header - Max Age. The cache gets cleared automatically when the max age is reached but we need the provision to clear the cache whenever required.

 

I have tried using Postman but it didn't work for us as Adobe documentation says "When the enableTTL flag is set and there is a corresponding <filename>.ttl file present in the cache, .stat files will not be considered when determining whether or not the requested <filename> is stale."

 

Is there a way we can clear the entire cache?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

If you use the TTL-based invalidation, the .stat-file based invalidation does not work. 

 

But if you activate a page/asset, it will not not only be invalidated based on the stat-file, but in the dispatcher it will be removed as well (so it will re-fetched on the next request). Of course this only works for this page/asset, not for its siblings.

3 replies

arunpatidar
Community Advisor
Community Advisor
December 7, 2023

Hi @abhishek_narula25 
Did you try Delete option?

 

POST /dispatcher/invalidate.cache HTTP/1.1
CQ-Action: Delete
CQ-Handle: path-pattern
Content-Length: 0

https://experienceleague.adobe.com/docs/experience-manager-learn/ams/dispatcher/disp-flushing.html?lang=en  

Arun Patidar
Abhishek_Narula25
Level 3
December 8, 2023

@arunpatidar I tried this already but it didn't work for me.

aanchal-sikka
Community Advisor
Community Advisor
December 8, 2023

Hello @abhishek_narula25 

 

AEM supports /statfileslevel and /invalidateto work together. This provides support for Longer TTL with Invalidation.

 

Before Dispatcher 4.3.5, the TTL invalidation logic was based only on the configured TTL value. With Dispatcher 4.3.5, both the set TTL and the Dispatcher cache invalidation rules are accounted for. As such, for a cached file:

  1. If /enableTTL is set to 1, the file expiration is checked. If the file has expired according to the set TTL, no other checks are performed and the cached file is re-requested from the backend.
  2. If the file has either not expired, or /enableTTL is not configured, then the standard cache invalidation rules are applied such as those rules that are set by /statfileslevel and /invalidate. This flow means that Dispatcher can invalidate files for which the TTL has not expired.

This new implementation supports use cases where files have a longer TTL (for example, on the CDN) but can still be invalidated even if the TTL has not expired. It favors content freshness over cache-hit ratio on the Dispatcher.

 

Refer to this: https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/dispatcher-configuration.html?lang=en#configuring-time-based-cache-invalidation-enablettl

 

Aanchal Sikka
Abhishek_Narula25
Level 3
December 8, 2023

Hi @aanchal-sikka 

I have read this article but the ask here is "Is there any way to clear cache on demand when TTL is enabled?".

I have tried several ways but nothing worked for me.

 

Can "ACS AEM Commons - Dispatcher Flush UI" help here?

aanchal-sikka
Community Advisor
Community Advisor
December 8, 2023

@abhishek_narula25 

Updating answer, as it is bit incorrect. Apologies ...

 

  • So, if your dispatcher version is >  4.3.5 and no conflicting /invalidate rule, touching the .stat file should have worked with ttls. 

 

 

 

 

 

Aanchal Sikka
joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
December 10, 2023

If you use the TTL-based invalidation, the .stat-file based invalidation does not work. 

 

But if you activate a page/asset, it will not not only be invalidated based on the stat-file, but in the dispatcher it will be removed as well (so it will re-fetched on the next request). Of course this only works for this page/asset, not for its siblings.