org.infinispan.manager
Interface CacheContainer

All Known Subinterfaces:
CacheManager
All Known Implementing Classes:
DefaultCacheManager, RemoteCacheManager

public interface CacheContainer

Acts as an container of Caches. Each cache in the container is identified by a name. It also contains a default cache.

Since:
4.1
Author:
Mircea.Markus@jboss.com

Method Summary
<K,V> Cache<K,V>
getCache()
          Retrieves the default cache associated with this cache container.
<K,V> Cache<K,V>
getCache(String cacheName)
          Retrieves a named cache from the system.
 

Method Detail

getCache

<K,V> Cache<K,V> getCache()
Retrieves the default cache associated with this cache container.

As such, this method is always guaranteed to return the default cache.

NB: Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to ensure that at least one but only one caller calls stop() on the cache, and it does so with the awareness that others may be using the cache.

Returns:
the default cache.

getCache

<K,V> Cache<K,V> getCache(String cacheName)
Retrieves a named cache from the system. If the cache has been previously created with the same name, the running cache instance is returned. Otherwise, this method attempts to create the cache first.

In the case of a CacheManager: when creating a new cache, this method will use the configuration passed in to the CacheManager on construction, as a template, and then optionally apply any overrides previously defined for the named cache using the CacheManager.defineConfiguration(String, org.infinispan.config.Configuration) or CacheManager.defineConfiguration(String, String, org.infinispan.config.Configuration) methods, or declared in the configuration file.

NB: Shared caches are supported (and in fact encouraged) but if they are used it's the users responsibility to ensure that at least one but only one caller calls stop() on the cache, and it does so with the awareness that others may be using the cache.

Parameters:
cacheName - name of cache to retrieve
Returns:
a cache instance identified by cacheName

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.