Interface EmbeddedCacheManagerAdmin

    • Method Detail

      • createCache

        <K,​V> Cache<K,​V> createCache​(String name,
                                                 String template)
        Creates a cache on the container using the specified template.
        Specified by:
        createCache in interface CacheContainerAdmin<EmbeddedCacheManagerAdmin,​Configuration>
        Parameters:
        name - the name of the cache to create
        template - the template to use for the cache. If null, the configuration marked as default on the container will be used
        Returns:
        the cache
        Throws:
        CacheException - if a cache with the same name already exists
      • getOrCreateCache

        <K,​V> Cache<K,​V> getOrCreateCache​(String name,
                                                      String template)
        Retrieves an existing cache or creates one using the specified template if it doesn't exist
        Specified by:
        getOrCreateCache in interface CacheContainerAdmin<EmbeddedCacheManagerAdmin,​Configuration>
        Parameters:
        name - the name of the cache to create
        template - the template to use for the cache. If null, the configuration marked as default on the container will be used
        Returns:
        the cache
      • createCache

        <K,​V> Cache<K,​V> createCache​(String name,
                                                 Configuration configuration)
        Creates a cache across the cluster. The cache will survive topology changes, e.g. when a new node joins the cluster, it will automatically be created there. This method will wait for the cache to be created on all nodes before returning.
        Specified by:
        createCache in interface CacheContainerAdmin<EmbeddedCacheManagerAdmin,​Configuration>
        Type Parameters:
        K - the generic type of the key
        V - the generic type of the value
        Parameters:
        name - the name of the cache
        configuration - the configuration to use. It must be a clustered configuration (e.g. distributed)
        Returns:
        the cache
        Throws:
        CacheException - if a cache with the same name already exists
      • getOrCreateCache

        <K,​V> Cache<K,​V> getOrCreateCache​(String name,
                                                      Configuration configuration)
        Retrieves an existing cache or creates one across the cluster using the specified configuration. The cache will survive topology changes, e.g. when a new node joins the cluster, it will automatically be created there. This method will wait for the cache to be created on all nodes before returning.
        Specified by:
        getOrCreateCache in interface CacheContainerAdmin<EmbeddedCacheManagerAdmin,​Configuration>
        Type Parameters:
        K - the generic type of the key
        V - the generic type of the value
        Parameters:
        name - the name of the cache
        configuration - the configuration to use. It must be a clustered configuration (e.g. distributed)
        Returns:
        the cache