Class 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 the DefaultCacheManager 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 manager
        executorService - The executor to execute I/O operations
        conversionService - The conversion service
    • Method Detail

      • getCacheNames

        @NonNull
        public java.util.Set<java.lang.String> getCacheNames()
        Specified by:
        getCacheNames in interface CacheManager<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 interface CacheManager<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.