Reputation: 456
I have 2 microservices in spring boot (let's say microservice A and B) and client-server Hazelcast. There is some cache-building logic in microservice A and I want to use the same cache in microservice B. I know we can get the Map and use it. But what if there is a cache miss? is there any way to indicate the microservice A to build the cache and then return it to microservice B? If it's not possible, can we do something after we ship the cache-building logic to cache server? I don't want to have the same cache-building logic in multiple services.
Upvotes: 0
Views: 148
Reputation: 3150
One option here might be a MapLoader
When a map is first accessed (and so empty) map loader logic can be attached to populate it.
You can choose to load all content at once, per key on a cache miss, or a combination of the two.
Upvotes: 0