org.alfresco.repo.cache
Class EhCacheAdapter

java.lang.Object
  extended by org.alfresco.repo.cache.EhCacheAdapter
All Implemented Interfaces:
SimpleCache

public class EhCacheAdapter
extends java.lang.Object
implements SimpleCache

A thin adapter for Ehcache support.

Thread-safety is taken care of by the underlying Ehcache instance.

See Also:
org.springframework.cache.ehcache.EhCacheFactoryBean, org.springframework.cache.ehcache.EhCacheManagerFactoryBean

Constructor Summary
EhCacheAdapter()
           
 
Method Summary
 void clear()
           
 boolean contains(java.io.Serializable key)
           
 java.lang.Object get(java.io.Serializable key)
           
 java.util.Collection getKeys()
           
 void put(java.io.Serializable key, java.lang.Object value)
           
 void remove(java.io.Serializable key)
          Removes the cache entry whether or not the value stored against it is null.
 void setCache(net.sf.ehcache.Cache cache)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EhCacheAdapter

public EhCacheAdapter()
Method Detail

setCache

public void setCache(net.sf.ehcache.Cache cache)
Parameters:
cache - the backing Ehcache instance

contains

public boolean contains(java.io.Serializable key)
Specified by:
contains in interface SimpleCache
Parameters:
key - the cache key to check up on
Returns:
Returns true if there is a cache entry, regardless of whether the value itself is null

getKeys

public java.util.Collection getKeys()
Specified by:
getKeys in interface SimpleCache

get

public java.lang.Object get(java.io.Serializable key)
Specified by:
get in interface SimpleCache
Returns:
Returns the value associated with the key. It will be null if the value is null or if the cache doesn't have an entry.

put

public void put(java.io.Serializable key,
                java.lang.Object value)
Specified by:
put in interface SimpleCache
Parameters:
key - the key against which to store the value
value - the value to store. null is allowed.

remove

public void remove(java.io.Serializable key)
Description copied from interface: SimpleCache
Removes the cache entry whether or not the value stored against it is null.

Specified by:
remove in interface SimpleCache
Parameters:
key - the key value to remove

clear

public void clear()
Specified by:
clear in interface SimpleCache


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.