Class DefaultCacheManager<C>

  • Type Parameters:
    C - The native cache implementation
    All Implemented Interfaces:
    CacheManager<C>

    @Singleton
    @Primary
    public class DefaultCacheManager<C>
    extends java.lang.Object
    implements CacheManager<C>
    Default implementation of the CacheManager interface.
    Since:
    1.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SyncCache<C> getCache​(java.lang.String name)
      Retrieve a cache for the given name.
      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
    • Constructor Detail

      • DefaultCacheManager

        @Inject
        public DefaultCacheManager​(java.util.List<SyncCache<C>> caches,
                                   @Nullable
                                   io.micronaut.context.BeanProvider<DynamicCacheManager<C>> dynamicCacheManager)
        Create default cache manager for the given caches.
        Parameters:
        caches - List of synchronous cache implementations
        dynamicCacheManager - The dynamic cache manager
      • DefaultCacheManager

        public DefaultCacheManager​(SyncCache<C>... caches)
        Create default cache manager for the given caches.
        Parameters:
        caches - List of synchronous cache implementations
    • Method Detail

      • getCacheNames

        @NonNull
        public java.util.Set<java.lang.String> getCacheNames()
        Specified by:
        getCacheNames in interface CacheManager<C>
        Returns:
        The names of the active caches
      • getCache

        @NonNull
        public SyncCache<C> getCache​(java.lang.String name)
        Description copied from interface: CacheManager
        Retrieve a cache for the given name.
        Specified by:
        getCache in interface CacheManager<C>
        Parameters:
        name - The name of the cache
        Returns:
        The SyncCache instance