org.wamblee.cache
Interface Cache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>

All Known Implementing Classes:
EhCache, ForeverCache, ZeroCache

public interface Cache<KeyType extends java.io.Serializable,ValueType extends java.io.Serializable>

The Cache interface represents... a cache. In some circumstances it is more optimal to implement caching directly in the code instead of relying on Hibernate caching methods. This interface abstracts from the used cache implementation. Cache implementations must be thread-safe.


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.
 

Method Detail

put

void put(KeyType aKey,
         ValueType aValue)
Adds a key-value pair to the cache.

Parameters:
aKey - Key.
aValue - Value.

get

ValueType get(KeyType aKey)
Retrieves a value from the cache.

Parameters:
aKey - Key to retrieve.
Returns:
Key.

remove

void remove(KeyType aKey)
Removes an entry from the cache.

Parameters:
aKey - Key to remove the entry for.

clear

void clear()
Removes all entries from the cache.



Copyright © 2010. All Rights Reserved.