Class CacheManagerImpl
java.lang.Object
com.github.benmanes.caffeine.jcache.CacheManagerImpl
- All Implemented Interfaces:
Closeable
,AutoCloseable
,javax.cache.CacheManager
An implementation of JSR-107
CacheManager
that manages Caffeine-based caches.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final javax.cache.spi.CachingProvider
private final Map
<String, CacheProxy<?, ?>> private final WeakReference
<ClassLoader> private boolean
private final Properties
private final boolean
private final URI
-
Constructor Summary
ConstructorsConstructorDescriptionCacheManagerImpl
(javax.cache.spi.CachingProvider cacheProvider, URI uri, ClassLoader classLoader, Properties properties) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
<K,
V, C extends javax.cache.configuration.Configuration<K, V>>
javax.cache.Cache<K, V> createCache
(String cacheName, C configuration) void
destroyCache
(String cacheName) void
enableManagement
(String cacheName, boolean enabled) void
enableStatistics
(String cacheName, boolean enabled) <K,
V> CacheProxy <K, V> <K,
V> @Nullable javax.cache.Cache <K, V> javax.cache.spi.CachingProvider
@Nullable ClassLoader
getURI()
boolean
isClosed()
private void
Checks that the cache manager is not closed.<T> T
-
Field Details
-
classLoaderReference
-
caches
-
cacheProvider
private final javax.cache.spi.CachingProvider cacheProvider -
properties
-
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 interfacejavax.cache.CacheManager
-
getURI
- Specified by:
getURI
in interfacejavax.cache.CacheManager
-
getClassLoader
- Specified by:
getClassLoader
in interfacejavax.cache.CacheManager
-
getProperties
- Specified by:
getProperties
in interfacejavax.cache.CacheManager
-
createCache
public <K,V, javax.cache.Cache<K,C extends javax.cache.configuration.Configuration<K, V>> V> createCache(String cacheName, C configuration) - Specified by:
createCache
in interfacejavax.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 interfacejavax.cache.CacheManager
-
getCache
- Specified by:
getCache
in interfacejavax.cache.CacheManager
-
getCacheNames
- Specified by:
getCacheNames
in interfacejavax.cache.CacheManager
-
destroyCache
- Specified by:
destroyCache
in interfacejavax.cache.CacheManager
-
enableManagement
- Specified by:
enableManagement
in interfacejavax.cache.CacheManager
-
enableStatistics
- Specified by:
enableStatistics
in interfacejavax.cache.CacheManager
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejavax.cache.CacheManager
- Specified by:
close
in interfaceCloseable
-
isClosed
public boolean isClosed()- Specified by:
isClosed
in interfacejavax.cache.CacheManager
-
unwrap
- Specified by:
unwrap
in interfacejavax.cache.CacheManager
-
requireNotClosed
private void requireNotClosed()Checks that the cache manager is not closed.
-