Class CaffeineCachingProvider
java.lang.Object
com.github.benmanes.caffeine.jcache.spi.CaffeineCachingProvider
- All Implemented Interfaces:
Closeable
,AutoCloseable
,javax.cache.spi.CachingProvider
public final class CaffeineCachingProvider
extends Object
implements javax.cache.spi.CachingProvider
A provider that produces a JCache implementation backed by Caffeine. Typically this provider is
instantiated using
Caching.getCachingProvider()
, which discovers this implementation
through a ServiceLoader
.
This provider is expected to be used for application life cycle events, like initialization. It is not expected that all requests flow through the provider to obtain the cache manager and cache instances for request operations. Internally, this implementation is synchronized to avoid using excess memory due to its infrequent usage.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
AClassLoader
that combinesThread.currentThread().getContextClassLoader()
andgetClass().getClassLoader()
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<ClassLoader, Map<URI, javax.cache.CacheManager>> private static final ClassLoader
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
activate()
void
close()
void
close
(ClassLoader classLoader) void
close
(URI uri, ClassLoader classLoader) javax.cache.CacheManager
javax.cache.CacheManager
getCacheManager
(URI uri, ClassLoader classLoader) javax.cache.CacheManager
getCacheManager
(URI uri, ClassLoader classLoader, Properties properties) private ClassLoader
getManagerClassLoader
(ClassLoader classLoader) private URI
getManagerUri
(URI uri) boolean
boolean
isSupported
(javax.cache.configuration.OptionalFeature optionalFeature)
-
Field Details
-
DEFAULT_CLASS_LOADER
-
cacheManagers
-
isOsgiComponent
private boolean isOsgiComponent
-
-
Constructor Details
-
CaffeineCachingProvider
public CaffeineCachingProvider()
-
-
Method Details
-
getDefaultClassLoader
- Specified by:
getDefaultClassLoader
in interfacejavax.cache.spi.CachingProvider
-
getDefaultURI
- Specified by:
getDefaultURI
in interfacejavax.cache.spi.CachingProvider
-
getDefaultProperties
- Specified by:
getDefaultProperties
in interfacejavax.cache.spi.CachingProvider
-
getCacheManager
public javax.cache.CacheManager getCacheManager()- Specified by:
getCacheManager
in interfacejavax.cache.spi.CachingProvider
-
getCacheManager
- Specified by:
getCacheManager
in interfacejavax.cache.spi.CachingProvider
-
getCacheManager
public javax.cache.CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) - Specified by:
getCacheManager
in interfacejavax.cache.spi.CachingProvider
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacejavax.cache.spi.CachingProvider
- Specified by:
close
in interfaceCloseable
-
close
- Specified by:
close
in interfacejavax.cache.spi.CachingProvider
-
close
- Specified by:
close
in interfacejavax.cache.spi.CachingProvider
-
isSupported
public boolean isSupported(javax.cache.configuration.OptionalFeature optionalFeature) - Specified by:
isSupported
in interfacejavax.cache.spi.CachingProvider
-
getManagerUri
-
getManagerClassLoader
-
activate
private void activate() -
isOsgiComponent
public boolean isOsgiComponent()
-