Expand my Community achievements bar.

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

how to cache data during the navigation in Adobe AEM Cloud Service

Avatar

Community Advisor

Hello guys,

 

how to cache data in Adobe AEM Cloud Service during a wizard and during fetching of external APIs

Thanks 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

As @kaikubad suggested you can go for Guava cache but if you are looking for something from ACS Common then you can refer https://adobe-consulting-services.github.io/acs-aem-commons/features/http-cache/ 



Arun Patidar

View solution in original post

2 Replies

Avatar

Community Advisor

You can use guava cache. We use it to cache api responses. But you have to keep a mechanism to clear the cache. Because if api data gets updated you will be need to purge the cache.

On corresponding request we check if the data is in guava cache. If there we pull the data from cache and send response. Otherwise we call the api, cache the data and send response

We are using hook to clear the cache. We have a common servlet with jwt authentication. So when api data gets updated or we need to purge the cache then the servlet is called.
Follow the documentation here

https://www.baeldung.com/guava-cache
https://github.com/google/guava/wiki/CachesExplained

https://guava.dev/releases/21.0/api/docs/com/google/common/cache/Cache.html

 

Avatar

Correct answer by
Community Advisor

As @kaikubad suggested you can go for Guava cache but if you are looking for something from ACS Common then you can refer https://adobe-consulting-services.github.io/acs-aem-commons/features/http-cache/ 



Arun Patidar