java - Ehcache of spring doesn't work correctly between microservices -
i have monolithic application.according microservices appearance , needs adapt appearance splited small apps.you assume after splinting each microservice has model has 1 object same in microservices.the following example clearing.
into micro1:
class { private object obj; //getter , setter }
into micro2:
class b { private object obj; //getter , setter }
and object obj
has own repository , service , controller layer.
there config of ehcash of spring @ save method service layer of model. this:
@transactional @override @caching(evict = { @cacheevict(value = "obj", key = "#obj.id" ) }) public integer save(object obj) { //code here }
it working when application monolithic after spliting because of obj
dependency microservices , method(save method) repeated each microservice,the ehcash doesn't work correctly.
how do when each microservice affects object obj other microservices aware to.
there many solution can in problem , redis have integration spring , can use sloving problem , can read more in link
also there solutions likes hazelcast , it's datagrid , more simple key-value cache.
Comments
Post a Comment