I have a monolithic application.According to microservices appearance and It that needs to adapt with this appearance splited into small APPs.You assume after splinting each Microservice has a model that has one object that is same in all microservices.The following example for clearing.
Into Micro1:
Class A {
private Object obj;
//getter and setter
}
Into Micro2:
Class B {
private Object obj;
//getter and setter
}
and Object obj has its own repository and service and controller layer.
There is the config of ehcash of spring at save method into service layer of this model. like this:
@Transactional
@Override
@Caching(evict = { @CacheEvict(value = "obj", key = "#obj.id" ) })
public Integer save(Object obj) {
//Code here
}
It was working when the application was a monolithic but after spliting because of this obj as a dependency is into all Microservices and this method(save method) is repeated into each microservice,the ehcash doesn't work correctly.
How do I do that when each microservice affects the Object obj other microservices aware to.