org.xwiki.cache.internal
Class DefaultCacheManager

java.lang.Object
  extended by org.xwiki.cache.internal.DefaultCacheManager
All Implemented Interfaces:
CacheManager

@Component
@Singleton
public class DefaultCacheManager
extends java.lang.Object
implements CacheManager

The default implementation of CacheManager. It uses ConfigurationManager to find the cache an local cache hints to use to lookup cache components.

Since:
1.7M1
Version:
$Id$

Constructor Summary
DefaultCacheManager()
           
 
Method Summary
<T> Cache<T>
createNewCache(CacheConfiguration config)
          Find the cache implementation component to use and create a new cache.
<T> Cache<T>
createNewCache(CacheConfiguration config, java.lang.String cacheHint)
          Lookup the cache component with provided hint and create a new cache.
<T> Cache<T>
createNewLocalCache(CacheConfiguration config)
          Find the local cache implementation component to use and create a new cache.
 CacheFactory getCacheFactory()
          Lookup the cache creation component with provided hint return it.
 CacheFactory getCacheFactory(java.lang.String cacheHint)
          Lookup the cache creation component with provided hint return it.
 CacheFactory getLocalCacheFactory()
          Lookup the local cache creation component with provided hint return it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCacheManager

public DefaultCacheManager()
Method Detail

getCacheFactory

public CacheFactory getCacheFactory()
                             throws org.xwiki.component.manager.ComponentLookupException
Lookup the cache creation component with provided hint return it.

Specified by:
getCacheFactory in interface CacheManager
Returns:
the cache creation service to use.
Throws:
org.xwiki.component.manager.ComponentLookupException - error when searching for cache component.
See Also:
CacheManager.getCacheFactory()

getLocalCacheFactory

public CacheFactory getLocalCacheFactory()
                                  throws org.xwiki.component.manager.ComponentLookupException
Lookup the local cache creation component with provided hint return it.

Specified by:
getLocalCacheFactory in interface CacheManager
Returns:
the local cache creation service to use.
Throws:
org.xwiki.component.manager.ComponentLookupException - error when searching for cache component.
See Also:
CacheManager.getLocalCacheFactory()

getCacheFactory

public CacheFactory getCacheFactory(java.lang.String cacheHint)
                             throws org.xwiki.component.manager.ComponentLookupException
Lookup the cache creation component with provided hint return it.

Parameters:
cacheHint - the role hint to lookup.
Returns:
a cache creation service.
Throws:
org.xwiki.component.manager.ComponentLookupException - error when searching for cache component.

createNewCache

public <T> Cache<T> createNewCache(CacheConfiguration config)
                        throws CacheException
Find the cache implementation component to use and create a new cache.

Specified by:
createNewCache in interface CacheManager
Type Parameters:
T - the class of the data stored in the cache.
Parameters:
config - the cache configuration.
Returns:
a new Cache.
Throws:
CacheException - error when creating the cache.
See Also:
CacheManager.createNewCache(org.xwiki.cache.config.CacheConfiguration)

createNewLocalCache

public <T> Cache<T> createNewLocalCache(CacheConfiguration config)
                             throws CacheException
Find the local cache implementation component to use and create a new cache.

The new cache is based on a local storing implementation (to oppose to distributed cache) and is generally used for not big cache needing very quick access to datas.

Specified by:
createNewLocalCache in interface CacheManager
Type Parameters:
T - the class of the data stored in the cache.
Parameters:
config - the cache configuration.
Returns:
a new local Cache.
Throws:
CacheException - error when creating the cache.
See Also:
CacheManager.createNewLocalCache(org.xwiki.cache.config.CacheConfiguration)

createNewCache

public <T> Cache<T> createNewCache(CacheConfiguration config,
                                   java.lang.String cacheHint)
                        throws CacheException
Lookup the cache component with provided hint and create a new cache.

Type Parameters:
T - the class of the data stored in the cache.
Parameters:
config - the cache configuration.
cacheHint - the role hint to lookup.
Returns:
a new Cache.
Throws:
CacheException - error when creating the cache.


Copyright © 2004-2011 XWiki. All Rights Reserved.