org.castor.cache
Class DebuggingCacheProxy

java.lang.Object
  extended by org.castor.cache.DebuggingCacheProxy
All Implemented Interfaces:
Map<Object,Object>, Cache

public final class DebuggingCacheProxy
extends Object
implements Cache

A debugging cache proxy.

Since:
1.0
Version:
$Revision: 8102 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Ralf Joachim

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from interface org.castor.cache.Cache
DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE
 
Constructor Summary
DebuggingCacheProxy(Cache cache)
          Construct a DebugCacheProxy for given cache.
 
Method Summary
 void clear()
          
 void close()
          Life-cycle method to allow custom resource cleanup for a cache implementation.
 boolean containsKey(Object key)
          
 boolean containsValue(Object value)
          
 Set<Map.Entry<Object,Object>> entrySet()
          
 void expire(Object key)
          Remove the mapping identified by key from the cache.
 void expireAll()
          Removes all mappings from the cache.
 Object get(Object key)
          
 String getName()
          Get virtual name of this cache.
 String getType()
          Indicates the type of this cache.
 void initialize(Properties params)
          Lyfe-cycle method to allow custom initialization of cache implementations.
 boolean isEmpty()
          
 Set<Object> keySet()
          
 Object put(Object key, Object value)
          
 void putAll(Map<? extends Object,? extends Object> map)
          
 Object remove(Object key)
          
 int size()
          
 Collection<Object> values()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

DebuggingCacheProxy

public DebuggingCacheProxy(Cache cache)
Construct a DebugCacheProxy for given cache.

Parameters:
cache - The wrapped cache.
Method Detail

initialize

public void initialize(Properties params)
                throws CacheAcquireException
Lyfe-cycle method to allow custom initialization of cache implementations.

Specified by:
initialize in interface Cache
Parameters:
params - Parameters to initialize the cache (e.g. name, capacity).
Throws:
CacheAcquireException - If cache can not be initialized.

close

public void close()
Life-cycle method to allow custom resource cleanup for a cache implementation.

Specified by:
close in interface Cache

getType

public String getType()
Indicates the type of this cache.

Specified by:
getType in interface Cache
Returns:
The cache type.

getName

public String getName()
Get virtual name of this cache. Castor sets the cache name to the class name of the objects stored in the cache.

Specified by:
getName in interface Cache
Returns:
The cache name.

expire

public void expire(Object key)
Remove the mapping identified by key from the cache.

Specified by:
expire in interface Cache
Parameters:
key - the key that needs to be removed.

expireAll

public void expireAll()
Removes all mappings from the cache.

Specified by:
expireAll in interface Cache

size

public int size()

Specified by:
size in interface Map<Object,Object>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Map<Object,Object>

containsKey

public boolean containsKey(Object key)

Specified by:
containsKey in interface Map<Object,Object>

containsValue

public boolean containsValue(Object value)

Specified by:
containsValue in interface Map<Object,Object>

get

public Object get(Object key)

Specified by:
get in interface Map<Object,Object>

put

public Object put(Object key,
                  Object value)

Specified by:
put in interface Map<Object,Object>

remove

public Object remove(Object key)

Specified by:
remove in interface Map<Object,Object>

putAll

public void putAll(Map<? extends Object,? extends Object> map)

Specified by:
putAll in interface Map<Object,Object>

clear

public void clear()

Specified by:
clear in interface Map<Object,Object>

keySet

public Set<Object> keySet()

Specified by:
keySet in interface Map<Object,Object>

values

public Collection<Object> values()

Specified by:
values in interface Map<Object,Object>

entrySet

public Set<Map.Entry<Object,Object>> entrySet()

Specified by:
entrySet in interface Map<Object,Object>


Copyright © 2010. All Rights Reserved.