Class CaffeineCachingProvider
- java.lang.Object
-
- com.github.benmanes.caffeine.jcache.spi.CaffeineCachingProvider
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,javax.cache.spi.CachingProvider
public final class CaffeineCachingProvider extends java.lang.Object implements javax.cache.spi.CachingProviderA provider that produces a JCache implementation backed by Caffeine. Typically this provider is instantiated usingCaching.getCachingProvider(), which discovers this implementation through aServiceLoader.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 Classes Modifier and Type Class Description private static classCaffeineCachingProvider.JCacheClassLoaderAClassLoaderthat combinesThread.currentThread().getContextClassLoader()andgetClass().getClassLoader().
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.ClassLoader,java.util.Map<java.net.URI,javax.cache.CacheManager>>cacheManagersprivate static java.lang.ClassLoaderDEFAULT_CLASS_LOADERprivate booleanisOsgiComponent
-
Constructor Summary
Constructors Constructor Description CaffeineCachingProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidactivate()voidclose()voidclose(java.lang.ClassLoader classLoader)voidclose(java.net.URI uri, java.lang.ClassLoader classLoader)javax.cache.CacheManagergetCacheManager()javax.cache.CacheManagergetCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader)javax.cache.CacheManagergetCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader, java.util.Properties properties)java.lang.ClassLoadergetDefaultClassLoader()java.util.PropertiesgetDefaultProperties()java.net.URIgetDefaultURI()private java.lang.ClassLoadergetManagerClassLoader(java.lang.ClassLoader classLoader)private java.net.URIgetManagerUri(java.net.URI uri)booleanisOsgiComponent()booleanisSupported(javax.cache.configuration.OptionalFeature optionalFeature)
-
-
-
Method Detail
-
getDefaultClassLoader
public java.lang.ClassLoader getDefaultClassLoader()
- Specified by:
getDefaultClassLoaderin interfacejavax.cache.spi.CachingProvider
-
getDefaultURI
public java.net.URI getDefaultURI()
- Specified by:
getDefaultURIin interfacejavax.cache.spi.CachingProvider
-
getDefaultProperties
public java.util.Properties getDefaultProperties()
- Specified by:
getDefaultPropertiesin interfacejavax.cache.spi.CachingProvider
-
getCacheManager
public javax.cache.CacheManager getCacheManager()
- Specified by:
getCacheManagerin interfacejavax.cache.spi.CachingProvider
-
getCacheManager
public javax.cache.CacheManager getCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader)- Specified by:
getCacheManagerin interfacejavax.cache.spi.CachingProvider
-
getCacheManager
public javax.cache.CacheManager getCacheManager(java.net.URI uri, java.lang.ClassLoader classLoader, java.util.Properties properties)- Specified by:
getCacheManagerin interfacejavax.cache.spi.CachingProvider
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejavax.cache.spi.CachingProvider- Specified by:
closein interfacejava.io.Closeable
-
close
public void close(java.lang.ClassLoader classLoader)
- Specified by:
closein interfacejavax.cache.spi.CachingProvider
-
close
public void close(java.net.URI uri, java.lang.ClassLoader classLoader)- Specified by:
closein interfacejavax.cache.spi.CachingProvider
-
isSupported
public boolean isSupported(javax.cache.configuration.OptionalFeature optionalFeature)
- Specified by:
isSupportedin interfacejavax.cache.spi.CachingProvider
-
getManagerUri
private java.net.URI getManagerUri(java.net.URI uri)
-
getManagerClassLoader
private java.lang.ClassLoader getManagerClassLoader(java.lang.ClassLoader classLoader)
-
activate
private void activate()
-
isOsgiComponent
public boolean isOsgiComponent()
-
-