Syncing api token | Community
Skip to main content
Level 3
Nov 23, 2022 5:16 PM UTC
Solved

Syncing api token

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.
aanchal-sikka
aanchal-sikkaAccepted solution
New Participant
Sep 5, 2023 6:43 AM UTC

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

2 replies

aanchal-sikka
aanchal-sikkaAccepted solution
New Participant
Sep 5, 2023 6:43 AM UTC

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/

Translate
Aanchal Sikka
Avinash_Gupta_
New Participant
Nov 23, 2022 5:39 PM UTC

@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.

Translate