how to cache data during the navigation in Adobe AEM Cloud Service | Community
Skip to main content
Luca_Lattarini
New Participant
April 28, 2023
Solved

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

  • April 28, 2023
  • 2 replies
  • 1312 views

Hello guys,

 

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

Thanks 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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/ 

2 replies

arunpatidar
arunpatidarAccepted solution
New Participant
April 28, 2023

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
kaikubad
New Participant
April 28, 2023

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