org.exoplatform.services.cache.impl.jboss
Class AbstractExoCache

java.lang.Object
  extended by org.exoplatform.services.cache.impl.jboss.AbstractExoCache
All Implemented Interfaces:
ExoCache
Direct Known Subclasses:
LFUExoCacheCreator.LFUExoCache, LRUExoCacheCreator.LRUExoCache

public abstract class AbstractExoCache
extends Object
implements ExoCache

An ExoCache implementation based on Node. Created by The eXo Platform SAS Author : eXoPlatform exo@exoplatform.com 20 juil. 2009


Nested Class Summary
 class AbstractExoCache.CacheEventListener
           
 
Field Summary
protected  org.jboss.cache.TreeCache cache
           
 
Constructor Summary
AbstractExoCache(ExoCacheConfig config, org.jboss.cache.TreeCache cache)
           
 
Method Summary
 void addCacheListener(CacheListener listener)
          
 void clearCache()
          Clears the cache.
 Object get(Serializable name)
          Performs a lookup operation.
 List<Object> getCachedObjects()
          Returns a list of cached object that are considered as valid when the method is called.
 int getCacheHit()
          
 int getCacheMiss()
          
 int getCacheSize()
          
 String getLabel()
          
 String getName()
          
 boolean isDistributed()
          
 boolean isLogEnabled()
          
 boolean isReplicated()
          
 void put(Serializable name, Object obj)
          Performs a put in the cache.
 void putMap(Map<Serializable,Object> objs)
          Performs a put of all the entries provided by the map argument.
 Object remove(Serializable name)
          Removes an entry from the cache.
 List<Object> removeCachedObjects()
          Clears the cache and returns the list of cached object that are considered as valid when the method is called.
 void select(CachedObjectSelector selector)
          Selects a subset of the cache.
 void setDistributed(boolean distributed)
          
 void setLabel(String label)
          
 void setLogEnabled(boolean logEnabled)
          
 void setName(String name)
          
 void setReplicated(boolean replicated)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.exoplatform.services.cache.ExoCache
getLiveTime, getMaxSize, setLiveTime, setMaxSize
 

Field Detail

cache

protected final org.jboss.cache.TreeCache cache
Constructor Detail

AbstractExoCache

public AbstractExoCache(ExoCacheConfig config,
                        org.jboss.cache.TreeCache cache)
Method Detail

addCacheListener

public void addCacheListener(CacheListener listener)

Specified by:
addCacheListener in interface ExoCache

clearCache

public void clearCache()
                throws Exception
Clears the cache.

Specified by:
clearCache in interface ExoCache
Throws:
Exception - any exception

get

public Object get(Serializable name)
           throws Exception
Performs a lookup operation.

Specified by:
get in interface ExoCache
Parameters:
name - the cache key
Returns:
the cached value which may be evaluated to null
Throws:
Exception - any exception

getCacheHit

public int getCacheHit()

Specified by:
getCacheHit in interface ExoCache

getCacheMiss

public int getCacheMiss()

Specified by:
getCacheMiss in interface ExoCache

getCacheSize

public int getCacheSize()

Specified by:
getCacheSize in interface ExoCache

getCachedObjects

public List<Object> getCachedObjects()
Returns a list of cached object that are considered as valid when the method is called. Any non valid object will not be returnted.

Specified by:
getCachedObjects in interface ExoCache
Returns:
the list of cached objects

getLabel

public String getLabel()

Specified by:
getLabel in interface ExoCache

getName

public String getName()

Specified by:
getName in interface ExoCache

isDistributed

public boolean isDistributed()

Specified by:
isDistributed in interface ExoCache

isLogEnabled

public boolean isLogEnabled()

Specified by:
isLogEnabled in interface ExoCache

isReplicated

public boolean isReplicated()

Specified by:
isReplicated in interface ExoCache

put

public void put(Serializable name,
                Object obj)
         throws Exception
Performs a put in the cache.

Specified by:
put in interface ExoCache
Parameters:
name - the cache key
obj - the cached value
Throws:
Exception - any exception

putMap

public void putMap(Map<Serializable,Object> objs)
            throws Exception
Performs a put of all the entries provided by the map argument.

Specified by:
putMap in interface ExoCache
Parameters:
objs - the objects to put
Throws:
Exception - any exception

remove

public Object remove(Serializable name)
              throws Exception
Removes an entry from the cache.

Specified by:
remove in interface ExoCache
Parameters:
name - the cache key
Returns:
the previously cached value or null if no entry existed or that entry value was evaluated to null
Throws:
Exception - any exception

removeCachedObjects

public List<Object> removeCachedObjects()
                                 throws Exception
Clears the cache and returns the list of cached object that are considered as valid when the method is called. Any non valid object will not be returned.

Specified by:
removeCachedObjects in interface ExoCache
Returns:
the list of cached objects
Throws:
Exception - any exception

select

public void select(CachedObjectSelector selector)
            throws Exception
Selects a subset of the cache.

Specified by:
select in interface ExoCache
Parameters:
selector - the selector
Throws:
Exception - any exception

setDistributed

public void setDistributed(boolean distributed)

Specified by:
setDistributed in interface ExoCache

setLabel

public void setLabel(String label)

Specified by:
setLabel in interface ExoCache

setLogEnabled

public void setLogEnabled(boolean logEnabled)

Specified by:
setLogEnabled in interface ExoCache

setName

public void setName(String name)

Specified by:
setName in interface ExoCache

setReplicated

public void setReplicated(boolean replicated)

Specified by:
setReplicated in interface ExoCache


Copyright © 2009 eXo Platform SAS. All Rights Reserved.