Openfire 3.3.2 Javadoc

org.jivesoftware.util
Class CacheManager

java.lang.Object
  extended by org.jivesoftware.util.CacheManager

public class CacheManager
extends Object

Centralized management of caches. Caches are essential for performance and scalability.

Author:
Matt Tucker
See Also:
Cache

Constructor Summary
CacheManager()
           
 
Method Summary
static
<K,V> Cache<K,V>
getCache(String name)
          Returns the cache specified by name.
static Collection<Cache> getCaches()
          Returns the list of caches being managed by this manager.
static
<K,V> Cache<K,V>
initializeCache(String name, String propertiesName, int size)
          Initializes a cache given it's name and max size.
static
<K,V> Cache<K,V>
initializeCache(String name, String propertiesName, int size, long expirationTime)
          Initializes a cache given it's name, max size, and expiration time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheManager

public CacheManager()
Method Detail

initializeCache

public static <K,V> Cache<K,V> initializeCache(String name,
                                               String propertiesName,
                                               int size)
Initializes a cache given it's name and max size. The default expiration time of six hours will be used. If a cache with the same name has already been initialized, this method returns the existing cache.

The size and expiration time for the cache can be overridden by setting Jive properties in the format:

where CACHE_NAME is the name of the cache.

Parameters:
name - the name of the cache to initialize.
propertiesName - the properties file name prefix where settings for the cache are stored. The name is will be prefixed by "cache." before it is looked up.
size - the size the cache can grow to, in bytes.

initializeCache

public static <K,V> Cache<K,V> initializeCache(String name,
                                               String propertiesName,
                                               int size,
                                               long expirationTime)
Initializes a cache given it's name, max size, and expiration time. If a cache with the same name has already been initialized, this method returns the existing cache.

The size and expiration time for the cache can be overridden by setting Jive properties in the format:

where CACHE_NAME is the name of the cache.

Parameters:
name - the name of the cache to initialize.
propertiesName - the properties file name prefix where settings for the cache are stored. The name is will be prefixed by "cache." before it is looked up.
size - the size the cache can grow to, in bytes.
expirationTime - the default max lifetime of the cache, in milliseconds.

getCache

public static <K,V> Cache<K,V> getCache(String name)
Returns the cache specified by name. The cache must be initialized before this method can be called.

Parameters:
name - the name of the cache to return.
Returns:
the cache found, or null if no cache by that name has been initialized.

getCaches

public static Collection<Cache> getCaches()
Returns the list of caches being managed by this manager.

Returns:
the list of caches being managed by this manager.

Openfire 3.3.2 Javadoc

Copyright © 2003-2007 Jive Software.