Expand my Community achievements bar.

SOLVED

Syncing api token

Avatar

Level 4

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.

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

 

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

View solution in original post

2 Replies

Avatar

Community Advisor

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

Avatar

Correct answer by
Community Advisor

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

 

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