Package io.micronaut.cache.jcache
Class JCacheManager
- java.lang.Object
-
- io.micronaut.cache.jcache.JCacheManager
-
- All Implemented Interfaces:
CacheManager<javax.cache.Cache>
@Replaces(DefaultCacheManager.class) @Requires(beans=javax.cache.CacheManager.class) @Requires(property="micronaut.jcache.enabled",value="true",defaultValue="true") @Primary public class JCacheManager extends java.lang.Object implements CacheManager<javax.cache.Cache>
Adapter for JCache. Replaces theDefaultCacheManager
if a JCache bean is present.- Since:
- 1.1.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
JCACHE_ENABLED
Whether JCache integration is enabled.
-
Constructor Summary
Constructors Modifier Constructor Description protected
JCacheManager(javax.cache.CacheManager cacheManager, java.util.concurrent.ExecutorService executorService, io.micronaut.core.convert.ConversionService<?> conversionService)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SyncCache<javax.cache.Cache>
getCache(java.lang.String name)
Retrieve a cache for the given name.javax.cache.CacheManager
getCacheManager()
java.util.Set<java.lang.String>
getCacheNames()
-
-
-
Field Detail
-
JCACHE_ENABLED
public static final java.lang.String JCACHE_ENABLED
Whether JCache integration is enabled.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JCacheManager
protected JCacheManager(@NonNull javax.cache.CacheManager cacheManager, @NonNull @Named("io") java.util.concurrent.ExecutorService executorService, @NonNull io.micronaut.core.convert.ConversionService<?> conversionService)
Default constructor.- Parameters:
cacheManager
- The cache managerexecutorService
- The executor to execute I/O operationsconversionService
- The conversion service
-
-
Method Detail
-
getCacheNames
@NonNull public java.util.Set<java.lang.String> getCacheNames()
- Specified by:
getCacheNames
in interfaceCacheManager<javax.cache.Cache>
- Returns:
- The names of the active caches
-
getCache
@NonNull public SyncCache<javax.cache.Cache> getCache(java.lang.String name)
Description copied from interface:CacheManager
Retrieve a cache for the given name.- Specified by:
getCache
in interfaceCacheManager<javax.cache.Cache>
- Parameters:
name
- The name of the cache- Returns:
- The
SyncCache
instance
-
getCacheManager
@NonNull public javax.cache.CacheManager getCacheManager()
- Returns:
- The JCache cache manager.
-
-