Hello guys,
how to cache data in Adobe AEM Cloud Service during a wizard and during fetching of external APIs
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
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/
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
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/
Views
Likes
Replies