You can retrieve
javax.cache.Cache instances directly through
HazelcastInstance::getCache(String name) method.
HazelcastInstance::getCache(String name) is the full cache name except the Hazelcast prefix, i.e.,
If you create a cache through a
CacheManager which has its own specified URI scope (and/or specified classloader),
it must be prepended to the pure cache name as a prefix while retrieving the cache through
Prefix generation for full cache name (except the Hazelcast prefix, which is
/hz/) is exposed through
com.hazelcast.cache.CacheUtil#getPrefixedCacheName(String name, java.net.URI uri, ClassLoader classloader).
If the URI scope and classloader is not specified, the pure cache name can be used directly while retrieving cache over
If you have a cache which is not created, but is defined/exists (cache is specified in Hazelcast configuration but not created yet), you can retrieve this cache by its name. This also triggers cache creation before retrieving it. This retrieval is supported through
HazelcastInstance does not support creating a cache by specifying configuration; this is supported by Hazelcast's
CacheManager as it is.
NOTE: If a valid (rather than 1.0.0-PFD or 0.x versions) JCache library does not exist on the classpath,
IllegalStateException is thrown.
JCache and Hazelcast Instance Awareness
HazelcastInstance is injected into the following cache API interfaces (provided by
com.hazelcast.cache.ICache) if they implement
CacheEntryExpiredListener) [provided by