org.apache.shindig.common.cache.ehcache
Class EhConfiguredCache<K,V>

java.lang.Object
  extended by org.apache.shindig.common.cache.ehcache.EhConfiguredCache<K,V>
All Implemented Interfaces:
Cache<K,V>

public class EhConfiguredCache<K,V>
extends Object
implements Cache<K,V>

Produces a cache configured from ehcache.


Constructor Summary
EhConfiguredCache(String cacheName, net.sf.ehcache.CacheManager cacheManager)
           
 
Method Summary
 void addElement(K key, V value)
          Stores an entry into the cache.
 long getCapacity()
          Returns the capacity of the cache.
 V getElement(K key)
          Retrieves an entry for the cache.
 long getSize()
           
 V removeElement(K key)
          Removes an entry from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EhConfiguredCache

public EhConfiguredCache(String cacheName,
                         net.sf.ehcache.CacheManager cacheManager)
Method Detail

addElement

public void addElement(K key,
                       V value)
Description copied from interface: Cache
Stores an entry into the cache.

Specified by:
addElement in interface Cache<K,V>

getElement

public V getElement(K key)
Description copied from interface: Cache
Retrieves an entry for the cache.

Specified by:
getElement in interface Cache<K,V>
Returns:
The entry stored under the given key, or null if it doesn't exist.

removeElement

public V removeElement(K key)
Description copied from interface: Cache
Removes an entry from the cache.

Specified by:
removeElement in interface Cache<K,V>
Parameters:
key - The entry to return.
Returns:
The entry stored under the given key, or null if it doesn't exist.

getCapacity

public long getCapacity()
Description copied from interface: Cache
Returns the capacity of the cache.

Specified by:
getCapacity in interface Cache<K,V>
Returns:
a positive integer indicating the upper bound on the number of allowed elements in the cace, -1 signifies that the capacity is unbounded

getSize

public long getSize()
Specified by:
getSize in interface Cache<K,V>
Returns:
The current size of the cache. Note that this does not call getSize on the underlying cache, which is very expensive. This will not include the size of remote caches.


Copyright © 2007-2012. All Rights Reserved.