Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

dispatcher cache

Avatar

Level 2

Hi

In dispatcher i need to clear the cache for a component which basically reads a value which will be incremented in publish Mode.But because of the caching in the dispatcher mode, old values are retreived. But the component functionality works fine in publish mode.

 

EX: Suppose a value get incremented on clicking a button, I need to display the value based on the counter.

IN Publish: Most recent update is rendered.

But in dispatcher: Old values are getting rendered because of the caching.Suppose if i append somethng like http://sample.com?1234 

then since the url is not cached,then the component displays the most recent entries.

 

 

 

So is there a way to disable the caching for ceratin pages in dispatcher mode

1 Accepted Solution

Avatar

Correct answer by
Level 7

Well you could also do as you did in your first post. This is usually how CQ/AEM solves the problem with some includes that it don't want to be cached. Eg. in the javascript api there are methods for this where it simply adds a timestamp (as a querystring) to links that are supposed to be non-cachable. So your original solution seems like the right approach there if you don't want to configure the dispatcher.

/Johan

View solution in original post

4 Replies

Avatar

Level 7

Hi punith this is absolutely possible.
In the dispatcher.any file there is a caching section where you tell the dispatcher what to cache. In the rules section you could add this:
 

/rules { /0000  { /glob "*" /type "allow" } /0001  { /glob "/path/to/noncachablefile*" /type "deny" } }

This first allows everything but later denies caching for your certtain file.

Good Luck
/Johan

Avatar

Level 2

Thanks Johan and Scott,

But is there any way, though which the same can be achieved programatically.

 

Thanks

Avatar

Correct answer by
Level 7

Well you could also do as you did in your first post. This is usually how CQ/AEM solves the problem with some includes that it don't want to be cached. Eg. in the javascript api there are methods for this where it simply adds a timestamp (as a querystring) to links that are supposed to be non-cachable. So your original solution seems like the right approach there if you don't want to configure the dispatcher.

/Johan