Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to clear author dispatcher cache when we enableTTL?

Avatar

Level 4

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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.

View solution in original post

7 Replies

Avatar

Community Advisor

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?l...  



Arun Patidar

Avatar

Community Advisor

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-c...

 


Aanchal Sikka

Avatar

Level 4

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?

Avatar

Community Advisor

@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

Avatar

Level 4

The dispatcher version is 4.3.2. Maybe, that's the reason even after touching the .stat file, the cache is not treated as stale.

Avatar

Correct answer by
Employee Advisor

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.