How to update cache evict in all kubernate pods springboot #1017
-
Hi All, I have implemented the caffeine cache in my spring cloudgateway application, I have problem if I update or remove the cache in multiple kubernets pod envrionment if other pods its not getting updated or removed. How to implement that logic. please provide some guidance regrading this scenario. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Caffeine is a local cache, so how you want to handle coherency is your decision. A distributed cache would take care of that for you and caffeine is used behind the scenes by Coherence, Infinispan, and Redisson. A message queue can be used to broadcast messages to all clients, such as a key invalidation or refresh. I recall that Redis built in this pattern natively on top of its pubsub for local caches. It is simple to build yourself on any MQ if you already use one. You can query for all hosts and execute a curl using kubectl. That only requires an endpoint, making it easy to publish a config change or invalidate all caches in a pod. It’s not application oriented, more of a devops use case. More often than not, these options are more complex than what users need. Instead expireAfterWrite may be used to for consistency after a time window. What makes the most sense is specific to your application and team. That’s out of scope for this project to provide or recommend an approach. |
Beta Was this translation helpful? Give feedback.
Caffeine is a local cache, so how you want to handle coherency is your decision.
A distributed cache would take care of that for you and caffeine is used behind the scenes by Coherence, Infinispan, and Redisson.
A message queue can be used to broadcast messages to all clients, such as a key invalidation or refresh. I recall that Redis built in this pattern natively on top of its pubsub for local caches. It is simple to build yourself on any MQ if you already use one.
You can query for all hosts and execute a curl using kubectl. That only requires an endpoint, making it easy to publish a config change or invalidate all caches in a pod. It’s not application oriented, more of a devops use case.