Marian
Marian

Reputation: 387

infinispan cache initialization on application starts

I need to initialize one of my infinispan cache during application starting. I have distributed cache and a few nodes cluster and decided to do it in next way: To add cache manager listener with event CacheStarted, in case of this event get all data from DB and populate into particular cache. Could somebody please advice is it correct behavior or is there some another better solution? Thank you in advice.

Upvotes: 0

Views: 253

Answers (1)

Sebastian Łaskawiec
Sebastian Łaskawiec

Reputation: 2737

Does you app operate or library or client-server mode?

In case of the former, your cache will ready as soon as you create a CacheManager, so there is no reason to wait for the notification. In the second case - you implemented this properly.

Upvotes: 1

Related Questions