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 Details

  • 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 manager
      executorService - The executor to execute I/O operations
      conversionService - The conversion service
  • Method Details

    • getCacheNames

      @NonNull public @NonNull Set<String> getCacheNames()
      Specified by:
      getCacheNames in interface CacheManager<javax.cache.Cache>
      Returns:
      The names of the active caches
    • getCache

      @NonNull public @NonNull SyncCache<javax.cache.Cache> getCache(String name)
      Description copied from interface: CacheManager
      Retrieve a cache for the given name.
      Specified by:
      getCache in interface CacheManager<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.