I am using AEM as a Cloud Service and have created a component in which the data is rendered through the Content Fragments. To get the data stored in CFs, I have a GET request in my JS for the graphql persisted query. But the problem is the data is cached. No matter how many times I publish the CF, the data remains same and is updated after one day around or may take several days to be shown updated. This doc: https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-with-aem-headless/g... states that GET request in persisted queries are cached. But I don't want my request to be cached. How can I do that?
Solved! Go to Solution.
Hi @nikita24tailor ,
The same document talks about using cache-control - max-age feature to control caching. Have you tried that?
I tried but didn't get the idea for the fields provided in the Headers. If you can tell me which fields do I need to set in the Headers to stop caching, that would be helpful.
Try setting cache control max-age as 0. This will make the TTL as zero and response will be invalidated. Also, make sure to use right cache mechanism. For example, if you have both generic (cachable) and personalized (non-cachable) content coming from API, then combining responses on client side can also be considered.
Check the below explanation
Tried but didn't get the required results. I did set the max-age to 0, s-max-age to 0 and stale-while-revalidate to 0. But s-max-age does not change and is reflected as 7200 on publish.