In the Example JCache Application section, we have already seen a couple of the base classes and explained how those work. The following are quick descriptions of them:
The access point into the JCache API. It retrieves the general
CachingProvider backed by any compliant JCache
implementation, such as Hazelcast JCache.
The SPI that is implemented to bridge between the JCache API and the implementation itself. Hazelcast members and clients use different providers chosen as seen in the Configuring JCache Provider section which enable the JCache API to interact with Hazelcast clusters.
javax.cache.spi.CachingProvider::getCacheManager overload is used that takes a
java.lang.ClassLoader argument, this
classloader will be part of the scope of the created
java.cache.Cache and it is not possible to retrieve it on other members.
We advise not to use those overloads, as they are not meant to be used in distributed environments!
CacheManager provides the capability to create new and manage existing JCache caches.
javax.cache.Cache instance created with key and value types in the configuration
provides a type checking of those types at retrieval of the cache. For that reason, all non-types retrieval methods like
getCache throw an exception because types cannot be checked.
These two classes are used to configure a cache prior to retrieving it from a
therefore, acts as a common super type for all compatible configuration classes such as
Hazelcast itself offers a special implementation (
com.hazelcast.config.CacheConfig) of the
Configuration interface which
offers more options on the specific Hazelcast properties that can be set to configure features like synchronous and asynchronous
backups counts or selecting the underlying In Memory Format of the cache. For more information on this
configuration class, please see the reference in JCache Programmatic Configuration section.
This interface represents the cache instance itself. It is comparable to
java.util.Map but offers special operations dedicated
to the caching use case. Therefore, for example
java.util.Map::put, does not return the old
value previously assigned to the given key.
NOTE: Bulk operations on the
Cache interface guarantee atomicity per entry but not over
all given keys in the same bulk operations since no transactional behavior is applied over the whole batch process.