org.apache.commons.cache
Class NoOpCache

java.lang.Object
  extended by org.apache.commons.cache.BaseCache
      extended by org.apache.commons.cache.NoOpCache
All Implemented Interfaces:
Serializable, Cache

public class NoOpCache
extends BaseCache
implements Cache

A Cache that doesn't.

Version:
$Id: NoOpCache.java 155435 2005-02-26 13:17:27Z dirkv $
Author:
Rodney Waldhoff
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.commons.cache.BaseCache
_retrievalListeners, _storageListeners
 
Constructor Summary
NoOpCache()
           
 
Method Summary
 void clear()
          No-op.
 void clear(Serializable key)
          No-op.
 void clearGroup(Serializable group)
          No-op.
 boolean contains(Serializable key)
          Returns false
 Serializable[] getKeysForGroup(Serializable group)
          Returns an empty array.
 long getStat(CacheStat stat)
          Throws UnsupportedOperationException
 Serializable retrieve(Serializable key)
          Returns null.
 boolean store(Serializable key, Serializable val, Long expiry, Long cost, Serializable group)
          Returns false.
 
Methods inherited from class org.apache.commons.cache.BaseCache
broadcastCleared, broadcastCleared, broadcastNotRetrieved, broadcastNotStored, broadcastRetrieved, broadcastRetrieveRequested, broadcastStored, broadcastStoreRequested, registerRetrievalListener, registerStorageListener, store, unregisterRetrievalListener, unregisterRetrievalListeners, unregisterStorageListener, unregisterStorageListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.cache.Cache
registerRetrievalListener, registerStorageListener, store, unregisterRetrievalListener, unregisterRetrievalListeners, unregisterStorageListener, unregisterStorageListeners
 

Constructor Detail

NoOpCache

public NoOpCache()
Method Detail

store

public boolean store(Serializable key,
                     Serializable val,
                     Long expiry,
                     Long cost,
                     Serializable group)
Returns false.

Specified by:
store in interface Cache
Specified by:
store in class BaseCache
Parameters:
key - the key used to later obtain the val from me, which MUST NOT be null.
val - the val to store, which MUST NOT be null.
expiry - the timestamp at which the given val becomes stale, or null.
cost - the implemenation dependent cost of generating the val, or null.
group - a meta-key which can be used to clear the object later
Returns:
true if the val was stored, false otherwise.

retrieve

public Serializable retrieve(Serializable key)
Returns null.

Specified by:
retrieve in interface Cache
Specified by:
retrieve in class BaseCache
Parameters:
key - the key which MUST NOT be null.
Returns:
the previously stored value, or null.

getKeysForGroup

public Serializable[] getKeysForGroup(Serializable group)
Returns an empty array.

Specified by:
getKeysForGroup in interface Cache
Specified by:
getKeysForGroup in class BaseCache

contains

public boolean contains(Serializable key)
Returns false

Specified by:
contains in interface Cache
Specified by:
contains in class BaseCache
Parameters:
key - the key which MUST NOT be null.
Returns:
true if I have a value associated with the given key, false otherwise.

clear

public void clear(Serializable key)
No-op.

Specified by:
clear in interface Cache
Specified by:
clear in class BaseCache
Parameters:
key - the key which MUST NOT be null.

clearGroup

public void clearGroup(Serializable group)
No-op.

Specified by:
clearGroup in interface Cache
Overrides:
clearGroup in class BaseCache
Parameters:
group - the group which MUST NOT be null.

clear

public void clear()
No-op.

Specified by:
clear in interface Cache
Specified by:
clear in class BaseCache

getStat

public long getStat(CacheStat stat)
             throws UnsupportedOperationException
Throws UnsupportedOperationException

Specified by:
getStat in interface Cache
Overrides:
getStat in class BaseCache
Throws:
UnsupportedOperationException


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.