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 classAClassLoaderthat combinesThread.currentThread().getContextClassLoader()andgetClass().getClassLoader(). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<ClassLoader, Map<URI, javax.cache.CacheManager>> private static final ClassLoaderprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidactivate()voidclose()voidclose(ClassLoader classLoader) voidclose(URI uri, ClassLoader classLoader) javax.cache.CacheManagerjavax.cache.CacheManagergetCacheManager(URI uri, ClassLoader classLoader) javax.cache.CacheManagergetCacheManager(URI uri, ClassLoader classLoader, Properties properties) private ClassLoadergetManagerClassLoader(ClassLoader classLoader) private URIgetManagerUri(URI uri) booleanbooleanisSupported(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:
getDefaultClassLoaderin interfacejavax.cache.spi.CachingProvider
-
getDefaultURI
- Specified by:
getDefaultURIin interfacejavax.cache.spi.CachingProvider
-
getDefaultProperties
- Specified by:
getDefaultPropertiesin interfacejavax.cache.spi.CachingProvider
-
getCacheManager
public javax.cache.CacheManager getCacheManager()- Specified by:
getCacheManagerin interfacejavax.cache.spi.CachingProvider
-
getCacheManager
- Specified by:
getCacheManagerin interfacejavax.cache.spi.CachingProvider
-
getCacheManager
public javax.cache.CacheManager getCacheManager(URI uri, ClassLoader classLoader, Properties properties) - Specified by:
getCacheManagerin interfacejavax.cache.spi.CachingProvider
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacejavax.cache.spi.CachingProvider- Specified by:
closein interfaceCloseable
-
close
- Specified by:
closein interfacejavax.cache.spi.CachingProvider
-
close
- Specified by:
closein interfacejavax.cache.spi.CachingProvider
-
isSupported
public boolean isSupported(javax.cache.configuration.OptionalFeature optionalFeature) - Specified by:
isSupportedin interfacejavax.cache.spi.CachingProvider
-
getManagerUri
-
getManagerClassLoader
-
activate
private void activate() -
isOsgiComponent
public boolean isOsgiComponent()
-