8

I am trying to build a cache service for my application using spring. Cache needs to be populated from database.

My application runs on three nodes and would like all three nodes to be in sync with the cache. If one node gets an updated value in the cache, it should notify other nodes.

I looked at Spring Cache abstration and it does not talk about caching in cluster environment.

is there a way to propagate cache notifications to other nodes?

Ali Dehghani
  • 46,221
  • 15
  • 164
  • 151
kevin
  • 570
  • 4
  • 22
  • 1
    Spring Cache is just an abstraction. Clustering would be an issue for the actual implementation you're using. For example, If you're using Redis, you should config Spring to connect to your Redis cluster. – Ali Dehghani Aug 18 '16 at 22:09
  • 2
    I've been using EHcache for a while and its quite easy to configure. There is already a stackoverflow post about it as well: http://stackoverflow.com/questions/36934115/spring-boot-caching-with-ehcache – Sigmar Muuga Aug 18 '16 at 22:33

1 Answers1

3

Look at using the Spring memcached plugins for a distributed cache.

https://github.com/jacobhe/spring-boot-tomcat-memcached

Gandalf
  • 9,648
  • 8
  • 53
  • 88