Persisting data in Infinispan

Infinispan can use a CacheLoader interface to save the in-memory cache data to a persistent cache store, such as a database or text file. And during initialization, CacheLoader can pre-load the cache using data from the persistent cache store.

The following figure shows an Infinispan instance using a backend store:

Persisting data in Infinispan

The entries are fetched from the store lazily, when the get() operation can't find the value in the cache the cache loader enters in action. The object returned by CacheLoader will be stored into the cache and reused as a response to the get() request.

Once the entry is in the memory available for modifications, ...

Get Infinispan Data Grid Platform Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.