org.mmbase.cache
Class CacheManager

java.lang.Object
  extended by org.mmbase.cache.CacheManager
All Implemented Interfaces:
CacheManagerMBean

public class CacheManager
extends Object
implements CacheManagerMBean

Cache manager manages the static methods of Cache. If you prefer you can call them on this in stead. Since 1.9.1 this class represents a singleton. Actually most methods should more logically not be static any more.

Since:
MMBase-1.8
Version:
$Id: CacheManager.java 42517 2010-06-11 10:13:10Z michiel $

Nested Class Summary
static class CacheManager.Bean<K,V>
           
 
Method Summary
 String clear(String pattern)
           
 String disable(String pattern)
           
 String enable(String pattern)
           
static CacheManager.Bean getBean(String name)
          Returns a cache wrapped in a 'Bean', so it is not a Map any more.
static Cache getCache(String name)
          Returns the Cache with a certain name.
static Set<String> getCaches()
          Returns the names of all caches.
static Set<CacheManager.Bean> getCaches(String className)
           
static CacheManager getInstance()
           
static Map<String,Cache<?,?>> getMap()
           
static int getTotalByteSize()
           
static
<K,V> Cache<K,V>
putCache(Cache<K,V> cache)
          Puts a cache in the caches repository.
 String readConfiguration()
           
static Object remove(String name, Object key)
          Used in config/functions/caches.xml
static void shutdown()
          Clears and dereferences all caches.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CacheManager getInstance()
Since:
MMBase-1.9.1

getCache

public static Cache getCache(String name)
Returns the Cache with a certain name. To be used in combination with getCaches(). If you need a certain cache, you can just as well call the non-static 'getCache' which is normally in cache singletons.

See Also:
getCaches(java.lang.String)

getBean

public static CacheManager.Bean getBean(String name)
Returns a cache wrapped in a 'Bean', so it is not a Map any more. This makes it easier accesible by tools which want that (like EL).

Since:
MMBase-1.9

getCaches

public static Set<CacheManager.Bean> getCaches(String className)

getCaches

public static Set<String> getCaches()
Returns the names of all caches.

Returns:
A Set containing the names of all caches.

getMap

public static Map<String,Cache<?,?>> getMap()
Since:
MMBase-1.8.6

putCache

public static <K,V> Cache<K,V> putCache(Cache<K,V> cache)
Puts a cache in the caches repository. This function will be called in the static of childs, therefore it is protected.

Parameters:
cache - A cache.
Returns:
The previous cache of the same type (stored under the same name)

getTotalByteSize

public static int getTotalByteSize()

shutdown

public static void shutdown()
Clears and dereferences all caches. To be used on shutdown of MMBase.

Since:
MMBase-1.8.1

remove

public static Object remove(String name,
                            Object key)
Used in config/functions/caches.xml


clear

public String clear(String pattern)
Specified by:
clear in interface CacheManagerMBean
Since:
MMBase-1.9.1

enable

public String enable(String pattern)
Specified by:
enable in interface CacheManagerMBean
Since:
MMBase-1.9.1

disable

public String disable(String pattern)
Specified by:
disable in interface CacheManagerMBean
Since:
MMBase-1.9.1

readConfiguration

public String readConfiguration()
Specified by:
readConfiguration in interface CacheManagerMBean
Since:
MMBase-1.9.1


MMBase 2.0-SNAPSHOT - null