fr.paris.lutece.portal.service.cache
Class AbstractCacheableService

java.lang.Object
  extended by fr.paris.lutece.portal.service.cache.AbstractCacheableService
All Implemented Interfaces:
CacheableService, LuteceService
Direct Known Subclasses:
ContentService, ResourceService

public abstract class AbstractCacheableService
extends java.lang.Object
implements CacheableService

Base implementation for a cacheable service


Constructor Summary
AbstractCacheableService()
           
 
Method Summary
 net.sf.ehcache.Cache getCache()
          Return a cache object
 int getCacheSize()
          Gets the number of item currently in the cache.
protected  java.lang.Object getFromCache(java.lang.String strKey)
          Gets an object from the cache
protected  void initCache(java.lang.String strCacheName)
          Init the cache.
 boolean isCacheEnable()
          Gets the current cache status.
protected  void putInCache(java.lang.String strKey, java.lang.Object object)
          Put an object into the cache
 void resetCache()
          Reset the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fr.paris.lutece.portal.service.util.LuteceService
getName
 

Constructor Detail

AbstractCacheableService

public AbstractCacheableService()
Method Detail

initCache

protected void initCache(java.lang.String strCacheName)
Init the cache. Should be called by the service at its initialization.

Parameters:
strCacheName - The cache name

putInCache

protected void putInCache(java.lang.String strKey,
                          java.lang.Object object)
Put an object into the cache

Parameters:
strKey - The key of the object to put into the cache
object - The object to put into the cache

getFromCache

protected java.lang.Object getFromCache(java.lang.String strKey)
Gets an object from the cache

Parameters:
strKey - The key of the object to retrieve from the cache
Returns:
The object from the cache

isCacheEnable

public boolean isCacheEnable()
Gets the current cache status.

Specified by:
isCacheEnable in interface CacheableService
Returns:
true if enable, otherwise false

resetCache

public void resetCache()
Reset the cache.

Specified by:
resetCache in interface CacheableService

getCacheSize

public int getCacheSize()
Gets the number of item currently in the cache.

Specified by:
getCacheSize in interface CacheableService
Returns:
the number of item currently in the cache.

getCache

public net.sf.ehcache.Cache getCache()
Return a cache object

Returns:
cache object


Copyright © 2009 Mairie de Paris. All Rights Reserved.