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

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

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

A cache that does not cache. This implementation is useful for disabling caching. Because of this implementation, application code does not need to distinguish between the situation where it a cache is used and where it isn't.

Author:
Erik Brakkee

Constructor Summary
ZeroCache()
          Creates a new ZeroCache object.
 
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

ZeroCache

public ZeroCache()
Creates a new ZeroCache object.

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.