org.wamblee.cache
Class EhCache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>

java.lang.Object
  extended by org.wamblee.cache.EhCache<KeyType,ValueType>
All Implemented Interfaces:
Cache<KeyType,ValueType>

public class EhCache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>
extends java.lang.Object
implements Cache<KeyType,ValueType>

Cache implemented on top of EhCache.

Author:
Erik Brakkee

Constructor Summary
EhCache(InputResource aResource, java.lang.String aCacheName)
          Constructs a cache based on EHCache.
 
Method Summary
 void clear()
          Removes all entries from the cache.
 ValueType get(KeyType aKey)
          Retrieves a value from the cache.
 void put(KeyType aKey, ValueType aValue)
          Adds a key-value pair to the cache.
 void remove(KeyType aKey)
          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

EhCache

public EhCache(InputResource aResource,
               java.lang.String aCacheName)
        throws java.io.IOException,
               net.sf.ehcache.CacheException
Constructs a cache based on EHCache.

Parameters:
aResource - Resource containing the configuration file for EHCache.
aCacheName - Name of the cache to use. If a cache with this name does not exist, one is created based on default settings.
Throws:
java.io.IOException
net.sf.ehcache.CacheException
Method Detail

put

public void put(KeyType aKey,
                ValueType aValue)
Description copied from interface: Cache
Adds a key-value pair to the cache.

Specified by:
put in interface Cache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>
Parameters:
aKey - Key.
aValue - Value.

get

public ValueType get(KeyType aKey)
Description copied from interface: Cache
Retrieves a value from the cache.

Specified by:
get in interface Cache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>
Parameters:
aKey - Key to retrieve.
Returns:
Key.

remove

public void remove(KeyType aKey)
Description copied from interface: Cache
Removes an entry from the cache.

Specified by:
remove in interface Cache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>
Parameters:
aKey - Key to remove the entry for.

clear

public void clear()
Description copied from interface: Cache
Removes all entries from the cache.

Specified by:
clear in interface Cache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>


Copyright © 2010. All Rights Reserved.