Interface ICacheManager


public interface ICacheManager
ICacheManager is the entry point to access JSR-107 (JCache) caches via HazelcastInstance interface. Hazelcast's ICacheManager provides access to JCache caches configured cluster-wide, even when created by different JCache CacheManagers.

Note that this interface is not related to JCache CacheManager. Its purpose is to host ICache related methods, separately from HazelcastInstance, in order to allow frameworks that make use of reflection and/or dynamic proxies (e.g. Mockito, Spring etc) to operate on HazelcastInstance when JCache is not on the classpath. See also related issue https://github.com/hazelcast/hazelcast/issues/8352.

Since:
3.7
  • Method Summary

    Modifier and Type Method Description
    <K,​ V> ICache<K,​V> getCache​(String name)
    Returns the cache instance with the specified prefixed cache name.
  • Method Details

    • getCache

      <K,​ V> ICache<K,​V> getCache​(String name)
      Returns the cache instance with the specified prefixed cache name.

      Prefixed cache name is the name with URI and classloader prefixes, if available. There is no Hazelcast prefix (/hz/). For example, myURI/foo.

      
           <prefixed_cache_name> = [<uri_prefix>/] + [<cl_prefix>/] + <pure_cache_name>
       
      where <pure_cache_name> is the cache name without any prefix. For example foo.

      As seen from the definition, URI and classloader prefixes are optional.

      URI prefix is generated as content of the URI as a US-ASCII string: (uri.toASCIIString()). Classloader prefix is generated as a string representation of the specified classloader: (cl.toString())

      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      name - the prefixed name of the cache
      Returns:
      the cache instance with the specified prefixed name
      Throws:
      CacheNotExistsException - if there is no configured or created cache with the specified prefixed name
      IllegalStateException - if a valid JCache library does not exist in the classpath (1.0.0-PFD or 0.x versions are not valid)
      See Also:
      CacheUtil.getPrefixedCacheName(String, java.net.URI, ClassLoader)