Package org.infinispan.commons.api
Interface CacheContainerAdmin<C extends CacheContainerAdmin,A extends BasicConfiguration>
- All Known Subinterfaces:
EmbeddedCacheManagerAdmin
,RemoteCacheManagerAdmin
- All Known Implementing Classes:
DefaultCacheManagerAdmin
,RemoteCacheManagerAdminImpl
public interface CacheContainerAdmin<C extends CacheContainerAdmin,A extends BasicConfiguration>
Administrative cache container operations.
- Since:
- 9.2
- Author:
- Tristan Tarrant
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
Flags which affect only administrative operations -
Method Summary
Modifier and TypeMethodDescriptionvoid
assignAlias
(String aliasName, String cacheName) Assign an alias to a cache.<K,
V> BasicCache <K, V> createCache
(String name, A configuration) Creates a cache on the container using the specified template.<K,
V> BasicCache <K, V> createCache
(String name, String template) Creates a cache on the container using the specified template.void
createTemplate
(String name, A configuration) Creates a template on the container using the provided configuration.<K,
V> BasicCache <K, V> getOrCreateCache
(String name, A configuration) Retrieves an existing cache or creates one using the specified template if it doesn't exist<K,
V> BasicCache <K, V> getOrCreateCache
(String name, String template) Retrieves an existing cache or creates one using the specified template if it doesn't existvoid
removeCache
(String name) Removes a cache from the cache container.void
removeTemplate
(String name) Removes a template from the cache container.void
updateConfigurationAttribute
(String cacheName, String attribute, String value) Updates a mutable configuration attribute for the given cache.Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations.withFlags
(CacheContainerAdmin.AdminFlag... flags) Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations.
-
Method Details
-
createCache
Creates a cache on the container using the specified template.- Parameters:
name
- the name of the cache to createtemplate
- 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
-
createCache
Creates a cache on the container using the specified template.- Parameters:
name
- the name of the cache to createconfiguration
- the configuration 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
Retrieves an existing cache or creates one using the specified template if it doesn't exist- Parameters:
name
- the name of the cache to createtemplate
- the template to use for the cache. If null, the configuration marked as default on the container will be used- Returns:
- the cache
-
getOrCreateCache
Retrieves an existing cache or creates one using the specified template if it doesn't exist- Parameters:
name
- the name of the cache to createconfiguration
- the configuration to use for the cache. If null, the configuration marked as default on the container will be used- Returns:
- the cache
-
removeCache
Removes a cache from the cache container. Any persisted data will be cleared.- Parameters:
name
- the name of the cache to remove
-
withFlags
Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations. Note: whether an operation supports a certain flag or not is dependent on the configuration and environment. If a flag cannot be honored, the operation will fail with an exception.- Parameters:
flags
-- Returns:
-
withFlags
Sets any additionalCacheContainerAdmin.AdminFlag
s to be used when performing administrative operations. Note: whether an operation supports a certain flag or not is dependent on the configuration and environment. If a flag cannot be honored, the operation will fail with an exception.- Parameters:
flags
-- Returns:
-
createTemplate
Creates a template on the container using the provided configuration.- Parameters:
name
- the name of the templateconfiguration
- the configuration to use. It must be a clustered configuration (e.g. distributed)
-
removeTemplate
Removes a template from the cache container. Any persisted data will be cleared.- Parameters:
name
- the name of the template to remove
-
updateConfigurationAttribute
Updates a mutable configuration attribute for the given cache.- Parameters:
cacheName
- the name of the cache on which the attribute will be updatedattribute
- the path of the attribute we want to changevalue
- the new value to apply to the attribute
-
assignAlias
Assign an alias to a cache. If the alias was already associated with another cache, the association will be reassigned to the specified cache. If the alias was not associated with any cache, it is created and associated to the specified cache. If the alias was already associated with the specified cache, this operation does nothing.- Parameters:
aliasName
- the name of the aliascacheName
- the name of the cache to which the alias should be associated
-