Class CarbonCacheManager

    • Method Detail

      • getOwnerTenantId

        public int getOwnerTenantId()
      • getName

        public String getName()
        Description copied from interface: CacheManager
        Get the name of this cache manager
        Specified by:
        getName in interface CacheManager
        Returns:
        the name of this cache manager
      • getStatus

        public Status getStatus()
        Description copied from interface: CacheManager
        Returns the status of this CacheManager.

        Calls to this method will block while the state is changing.

        Specified by:
        getStatus in interface CacheManager
        Returns:
        one of Status
      • createCacheBuilder

        public <K,​V> CacheBuilder<K,​V> createCacheBuilder​(String cacheName)
        Description copied from interface: CacheManager
        Creates a new CacheBuilder for the named cache to be managed by this cache manager.

        An example which creates a cache using default cache configuration is:

            Cache<Integer, Date> myCache2 = cacheManager.
                   <Integer, Date>createCacheBuilder("myCache2").
                   build();
         

        An example usage which programmatically sets many parameters of CacheConfiguration, specifies a CacheLoader and registrs listeners is:

            Cache<Integer, String> myCache1 = cacheManager.
                   <Integer, String>createCacheBuilder("myCache1").
                   setCacheLoader(cl).
                   setStoreByValue(true).
                   setReadThrough(true).
                   setWriteThrough(false).
                   setStatisticsEnabled(true).
                   setTransactionEnabled(false).
                   registerCacheEntryListener(listener1, NotificationScope.LOCAL, false).
                   registerCacheEntryListener(listener2, NotificationScope.LOCAL, false).
                   build();
         

        The returned CacheBuilder is associated with this CacheManager. The Cache will be created, added to the caches controlled by this CacheManager and started when CacheBuilder.build() is called. If there is an existing Cache of the same name associated with this CacheManager when build is invoked, an exception is thrown.

        Specified by:
        createCacheBuilder in interface CacheManager
        Parameters:
        cacheName - the name of the cache to build. A cache name must consist of at least one non-whitespace character.
        Returns:
        the CacheBuilder for the named cache
      • getCache

        public <K,​V> Cache<K,​V> getCache​(String cacheName)
        Description copied from interface: CacheManager
        Looks up a named cache.
        Specified by:
        getCache in interface CacheManager
        Parameters:
        cacheName - the name of the cache to look for
        Returns:
        the Cache or null if it does exist
      • getCaches

        public Iterable<Cache<?,​?>> getCaches()
        Description copied from interface: CacheManager
        Returns an Iterable over the caches managed by this CacheManager. The Iterable is immutable (iterator.remove will throw an IllegalStateException) and independent of the cache manager; if the caches managed by the cache manager change the Iterable is not affected
        Specified by:
        getCaches in interface CacheManager
        Returns:
        an Iterable over the managed Caches
      • removeCache

        public boolean removeCache​(String cacheName)
        Description copied from interface: CacheManager
        Remove a cache from the CacheManager. The cache will be stopped.
        Specified by:
        removeCache in interface CacheManager
        Parameters:
        cacheName - the cache name
        Returns:
        true if the cache was removed
      • isSupported

        public boolean isSupported​(OptionalFeature optionalFeature)
        Description copied from interface: CacheManager
        Indicates whether a optional feature is supported by this CacheManager.
        Specified by:
        isSupported in interface CacheManager
        Parameters:
        optionalFeature - the feature to check for
        Returns:
        true if the feature is supported
      • shutdown

        public void shutdown()
        Description copied from interface: CacheManager
        Shuts down the CacheManager.

        For each cache in the cache manager the CacheLifecycle.stop() method will be invoked, in no guaranteed order. If the stop throws an exception, the exception is ignored.

        Calls to CacheManager.getStatus() will block until shutdown completes.

        On completion the CacheManager's status is changed to Status.STOPPED, and the manager's owned caches will be empty and CacheManager.getCaches() will return an empty collection.

        A given CacheManager instance cannot be restarted after it has been stopped. A new one must be created.

        Specified by:
        shutdown in interface CacheManager
      • unwrap

        public <T> T unwrap​(Class<T> cls)
        Description copied from interface: CacheManager
        Return an object of the specified type to allow access to the provider-specific API. If the provider's implementation does not support the specified class, the IllegalArgumentException is thrown.
        Specified by:
        unwrap in interface CacheManager
        Parameters:
        cls - the class of the object to be returned. This is normally either the underlying implementation class or an interface that it implements.
        Returns:
        an instance of the specified class
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object