Having introduced some basic concepts of the Infinispan platform, we will now learn how to use the core API to store, retrieve, and remove data in it.
The core interface of Infinispan is org.infinispan.Cache
, which extends the java.util.concurrent.ConcurrentMap
, providing a highly concurrent and optionally distributed data structure. Compared with the ConcurrentMap interface, the Infinispan Cache has a lot of additional features, such as:
Eviction and expiration support to prevent
OutOfMemoryErrors
JTA transaction compatibility
Event notification via the Listeners
Persistence of entries to a cache store, to maintain copies that would withstand server failure or restarts
For the purpose of exploring the APIs, we will now construct a simple example that creates a cache to store in-memory data for a ticket booking system.