Class CacheManagerImpl

java.lang.Object
com.github.benmanes.caffeine.jcache.CacheManagerImpl
All Implemented Interfaces:
Closeable, AutoCloseable, javax.cache.CacheManager

public final class CacheManagerImpl extends Object implements javax.cache.CacheManager
An implementation of JSR-107 CacheManager that manages Caffeine-based caches.
  • Field Details

    • classLoaderReference

      private final WeakReference<ClassLoader> classLoaderReference
    • caches

      private final Map<String,CacheProxy<?,?>> caches
    • cacheProvider

      private final javax.cache.spi.CachingProvider cacheProvider
    • properties

      private final Properties properties
    • uri

      private final URI uri
    • runsAsAnOsgiBundle

      private final boolean runsAsAnOsgiBundle
    • closed

      private volatile boolean closed
  • Constructor Details

    • CacheManagerImpl

      public CacheManagerImpl(javax.cache.spi.CachingProvider cacheProvider, URI uri, ClassLoader classLoader, Properties properties)
  • Method Details

    • getCachingProvider

      public javax.cache.spi.CachingProvider getCachingProvider()
      Specified by:
      getCachingProvider in interface javax.cache.CacheManager
    • getURI

      public URI getURI()
      Specified by:
      getURI in interface javax.cache.CacheManager
    • getClassLoader

      public @Nullable ClassLoader getClassLoader()
      Specified by:
      getClassLoader in interface javax.cache.CacheManager
    • getProperties

      public Properties getProperties()
      Specified by:
      getProperties in interface javax.cache.CacheManager
    • createCache

      public <K, V, C extends javax.cache.configuration.Configuration<K, V>> javax.cache.Cache<K,V> createCache(String cacheName, C configuration)
      Specified by:
      createCache in interface javax.cache.CacheManager
    • getCache

      public <K, V> @Nullable javax.cache.Cache<K,V> getCache(String cacheName, Class<K> keyType, Class<V> valueType)
      Specified by:
      getCache in interface javax.cache.CacheManager
    • getCache

      public <K, V> CacheProxy<K,V> getCache(String cacheName)
      Specified by:
      getCache in interface javax.cache.CacheManager
    • getCacheNames

      public Iterable<String> getCacheNames()
      Specified by:
      getCacheNames in interface javax.cache.CacheManager
    • destroyCache

      public void destroyCache(String cacheName)
      Specified by:
      destroyCache in interface javax.cache.CacheManager
    • enableManagement

      public void enableManagement(String cacheName, boolean enabled)
      Specified by:
      enableManagement in interface javax.cache.CacheManager
    • enableStatistics

      public void enableStatistics(String cacheName, boolean enabled)
      Specified by:
      enableStatistics in interface javax.cache.CacheManager
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface javax.cache.CacheManager
      Specified by:
      close in interface Closeable
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface javax.cache.CacheManager
    • unwrap

      public <T> T unwrap(Class<T> clazz)
      Specified by:
      unwrap in interface javax.cache.CacheManager
    • requireNotClosed

      private void requireNotClosed()
      Checks that the cache manager is not closed.