org.figure8.join.services.cache
Class EhCacheManager

java.lang.Object
  extended by org.figure8.join.services.cache.EhCacheManager
All Implemented Interfaces:
CacheManager

public class EhCacheManager
extends java.lang.Object
implements CacheManager

Implementation of CacheManager using EHCache provider (see http://ehcache.sourceforge.net). It encapsulates a EH CacheManager.
This implementation is using a configuration file name "join-ehcache.xml". This file must be a classloader available resource.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux

Field Summary
static java.lang.String CONFIGURATION_FILE
          Constant for EHCache configuration file
 
Constructor Summary
EhCacheManager()
          Creates a new instance of EhCacheManager
 
Method Summary
 void clearCaches()
          Clear (ie. flush) all managed caches.
 void createCaches()
          Create all managed caches.
 Cache getCache(java.lang.String key)
          Retrieve a Cache using its key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_FILE

public static final java.lang.String CONFIGURATION_FILE
Constant for EHCache configuration file

See Also:
Constant Field Values
Constructor Detail

EhCacheManager

public EhCacheManager()
Creates a new instance of EhCacheManager

Method Detail

clearCaches

public void clearCaches()
                 throws CacheException
Clear (ie. flush) all managed caches. They should now be empty after this method call. If a cache cannot be cleared, best effort should be done to clear all other caches.

Specified by:
clearCaches in interface CacheManager
Throws:
CacheException - if at least one of the caches cannot be cleared

createCaches

public void createCaches()
                  throws CacheException
Create all managed caches. This method should be called during Join application initialization phase. Typically, implementation shall : read its configuration, build its manager and caches (& fetch some data ?).

Specified by:
createCaches in interface CacheManager
Throws:
CacheException - if at least one of the caches cannot be created

getCache

public Cache getCache(java.lang.String key)
Retrieve a Cache using its key

Specified by:
getCache in interface CacheManager
Parameters:
key - The key within is store the cache into the manager
Returns:
The retrieved Cache or null if there's no corresponding cache


Copyright © 2005-2008 Join. All Rights Reserved.