Syncing api token | Community
Skip to main content
Level 3
November 23, 2022
Solved

Syncing api token

  • November 23, 2022
  • 2 replies
  • 864 views

Hi all,

 

We have a api token which needs to be stored for 5 min for calling an api.

 

After 5 minutes,token gets expired.s

 

What is the best approach to store the token server side for 5 minutes before it get expired and how to sync the token in all the publishers.

 

 

 

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 aanchal-sikka

Hello @sb2512 

 

You can use EhCache or Apache JCS to implement cache. 

 

Apache JCS (Java Caching System) provides various caching options, including in-memory caching, disk caching, and even distributed caching.

https://rammohany.wordpress.com/2015/04/11/performance-tuning-in-aemcq-using-auxiliary-cache-like-ehcache/

 

EhCache which caches the object at the JVM level.

https://www.ehcache.org/documentation/2.8/code-samples.html

http://blog.atish.me/2016/12/25/AEM-Ehcache/

2 replies

Avinash_Gupta_
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
November 23, 2022

@sb2512 Why do you want to store the token on server side since the time duration is very less? Instead of storing the token on the server side, you can leverage either cookie or session storage to store the tokens for 5 minutes and after that expire the cookie or remove the session storage value.

 

Hope this help.

aanchal-sikka
Community Advisor
aanchal-sikkaCommunity AdvisorAccepted solution
Community Advisor
September 5, 2023

Hello @sb2512 

 

You can use EhCache or Apache JCS to implement cache. 

 

Apache JCS (Java Caching System) provides various caching options, including in-memory caching, disk caching, and even distributed caching.

https://rammohany.wordpress.com/2015/04/11/performance-tuning-in-aemcq-using-auxiliary-cache-like-ehcache/

 

EhCache which caches the object at the JVM level.

https://www.ehcache.org/documentation/2.8/code-samples.html

http://blog.atish.me/2016/12/25/AEM-Ehcache/

Aanchal Sikka