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 Object
implements CacheManager<javax.cache.Cache>
Adapter for JCache. Replaces the
DefaultCacheManager
if a JCache bean is present.- Since:
- 1.1.0
- Author:
- graemerocher
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
JCacheManager
(@NonNull javax.cache.CacheManager cacheManager, @NonNull ExecutorService executorService, @NonNull io.micronaut.core.convert.ConversionService conversionService) Default constructor. -
Method Summary
Modifier and TypeMethodDescription@NonNull SyncCache<javax.cache.Cache>
Retrieve a cache for the given name.@NonNull javax.cache.CacheManager
-
Field Details
-
JCACHE_ENABLED
Whether JCache integration is enabled.- See Also:
-
-
Constructor Details
-
JCacheManager
protected JCacheManager(@NonNull @NonNull javax.cache.CacheManager cacheManager, @NonNull @Named("io") @NonNull ExecutorService executorService, @NonNull @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 Details
-
getCacheNames
- Specified by:
getCacheNames
in interfaceCacheManager<javax.cache.Cache>
- Returns:
- The names of the active caches
-
getCache
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 @NonNull javax.cache.CacheManager getCacheManager()- Returns:
- The JCache cache manager.
-