1

We have a springboot application deployed in kubernetes with 4 pods. Now we want to maintain cache of a specific value using spring cache. Based on a specific event we need to update the cache value, but as the application is deployed on multiple instances, is there a way we can update the cache value on all the instances. I am aware this can be achieved if we use some centralized cache mechanism like Redis, but we are not yet there to integrate it. So is there a work around to achieve this?

Thanks in advance

DK93
  • 89
  • 1
  • 14
  • Memcached maybe? https://stackoverflow.com/questions/39028198/how-to-manage-spring-cache-in-cluster-environment – pringi Mar 04 '22 at 10:23

1 Answers1

0

I suggest using Hazelcast with your spring boot application(embedded cache topology)

In this case, the application and the cache data are running on the same node. When new data is written to cache, Hazelcast takes care of distributing it to the other members. So that data would be available for all the instances.

enter image description here

Please check this official documentation of Hazelcast to get an overview. https://guides.hazelcast.org/hazelcast-embedded-springboot/

Sam
  • 4,046
  • 8
  • 31
  • 47