com.atlassian.crowd.manager.cache
Class CacheManagerEhcache

java.lang.Object
  extended by com.atlassian.crowd.manager.cache.CacheManagerEhcache
All Implemented Interfaces:
CacheManager

public class CacheManagerEhcache
extends java.lang.Object
implements CacheManager


Constructor Summary
CacheManagerEhcache(net.sf.ehcache.CacheManager cacheManager)
           
 
Method Summary
 void afterPropertiesSet()
           
protected  void configureCache(java.lang.String cacheName)
          Creates a cache if it doesn't already exist - if the cache has been defined in the configuration xml, then it will not be recreated.
protected  void configureCaches()
           
 java.lang.Object get(java.lang.String key)
          Retrieves cached object from the default cache.
 java.lang.Object get(java.lang.String cacheName, java.io.Serializable key)
          Retrieves cached object.
 java.util.List getAllKeys()
          Retrieves all keys from the default cache.
 java.util.List getAllKeys(java.lang.String cacheName)
          Retrieve all keys from the cache.
protected  net.sf.ehcache.Cache getCache(java.lang.String cacheName)
           
 void put(java.lang.String key, java.io.Serializable obj)
          Saves object to the default cache
 void put(java.lang.String cacheName, java.io.Serializable key, java.io.Serializable obj)
          Saves object to the cache.
 boolean remove(java.lang.String key)
          Removes cached object from the default cache
 boolean remove(java.lang.String cacheName, java.io.Serializable key)
          Removes cached object from the cache.
 void removeAll()
          Remove all the entries from the default cache.
 void removeAll(java.lang.String cacheName)
          Removes all the entries from the given cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheManagerEhcache

public CacheManagerEhcache(net.sf.ehcache.CacheManager cacheManager)
Method Detail

configureCaches

protected void configureCaches()

configureCache

protected void configureCache(java.lang.String cacheName)
Creates a cache if it doesn't already exist - if the cache has been defined in the configuration xml, then it will not be recreated.

Parameters:
cacheName - Name of the cache to ensure exists

getCache

protected net.sf.ehcache.Cache getCache(java.lang.String cacheName)

get

public java.lang.Object get(java.lang.String key)
                     throws CacheManagerException,
                            NotInCacheException
Description copied from interface: CacheManager
Retrieves cached object from the default cache.

Specified by:
get in interface CacheManager
Parameters:
key - key of the object
Returns:
cached object
Throws:
CacheManagerException - if any problems arise during the operation
NotInCacheException - if the key does not exist

put

public void put(java.lang.String key,
                java.io.Serializable obj)
         throws CacheManagerException
Description copied from interface: CacheManager
Saves object to the default cache

Specified by:
put in interface CacheManager
Parameters:
key - key of the object
obj - actual object to be cached
Throws:
CacheManagerException - if any problems arise during the operation

remove

public boolean remove(java.lang.String key)
               throws CacheManagerException
Description copied from interface: CacheManager
Removes cached object from the default cache

Specified by:
remove in interface CacheManager
Parameters:
key - key of the object
Returns:
true if the key exists
Throws:
CacheManagerException - if any problems arise during the operation

removeAll

public void removeAll()
               throws CacheManagerException
Description copied from interface: CacheManager
Remove all the entries from the default cache.

Specified by:
removeAll in interface CacheManager
Throws:
CacheManagerException - if any problems arise during the operation

getAllKeys

public java.util.List getAllKeys()
                          throws CacheManagerException
Description copied from interface: CacheManager
Retrieves all keys from the default cache.

Specified by:
getAllKeys in interface CacheManager
Returns:
list of keys
Throws:
CacheManagerException - if any problems arise during the operation

put

public void put(java.lang.String cacheName,
                java.io.Serializable key,
                java.io.Serializable obj)
         throws CacheManagerException
Description copied from interface: CacheManager
Saves object to the cache.

Specified by:
put in interface CacheManager
Parameters:
cacheName - cache name
key - key of the object
obj - actual object to be cached
Throws:
CacheManagerException - if any problems arise during the operation

get

public java.lang.Object get(java.lang.String cacheName,
                            java.io.Serializable key)
                     throws CacheManagerException,
                            NotInCacheException
Description copied from interface: CacheManager
Retrieves cached object.

Specified by:
get in interface CacheManager
Parameters:
cacheName - cache name
key - key of the object
Returns:
cached object
Throws:
CacheManagerException - if any problems arise during the operation
NotInCacheException - if the key does not exist

remove

public boolean remove(java.lang.String cacheName,
                      java.io.Serializable key)
               throws CacheManagerException
Description copied from interface: CacheManager
Removes cached object from the cache.

Specified by:
remove in interface CacheManager
Parameters:
cacheName - cache name
key - key of the object
Returns:
if an element was removed as a result of this call
Throws:
CacheManagerException - if any problems arise during the operation

removeAll

public void removeAll(java.lang.String cacheName)
               throws CacheManagerException
Description copied from interface: CacheManager
Removes all the entries from the given cache.

Specified by:
removeAll in interface CacheManager
Parameters:
cacheName - cache name.
Throws:
CacheManagerException - if any problems arise during the operation

getAllKeys

public java.util.List getAllKeys(java.lang.String cacheName)
                          throws CacheManagerException
Description copied from interface: CacheManager
Retrieve all keys from the cache.

Specified by:
getAllKeys in interface CacheManager
Parameters:
cacheName - cache name.
Returns:
list of keys.
Throws:
CacheManagerException

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2011 Atlassian. All Rights Reserved.