org.castor.cache
Class DebuggingCacheProxy<K,V>

java.lang.Object
  extended by org.castor.cache.DebuggingCacheProxy<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of cached values
All Implemented Interfaces:
Map<K,V>, Cache<K,V>

public final class DebuggingCacheProxy<K,V>
extends Object
implements Cache<K,V>

A debugging cache proxy.

Since:
1.0
Version:
$Revision: 9040 $ $Date: 2011-08-16 08:26:59 +0200 (Di, 16 Aug 2011) $
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<K,V> 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<K,V>> entrySet()
          
 void expire(Object key)
          Remove the mapping identified by key from the cache.
 void expireAll()
          Removes all mappings from the cache.
 V 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<K> keySet()
          
 V put(K key, V value)
          
 void putAll(Map<? extends K,? extends V> map)
          
 V remove(Object key)
          
 int size()
          
 Collection<V> 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<K,V> 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<K,V>
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<K,V>

getType

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

Specified by:
getType in interface Cache<K,V>
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<K,V>
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<K,V>
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<K,V>

size

public int size()

Specified by:
size in interface Map<K,V>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Map<K,V>

containsKey

public boolean containsKey(Object key)

Specified by:
containsKey in interface Map<K,V>

containsValue

public boolean containsValue(Object value)

Specified by:
containsValue in interface Map<K,V>

get

public V get(Object key)

Specified by:
get in interface Map<K,V>

put

public V put(K key,
             V value)

Specified by:
put in interface Map<K,V>

remove

public V remove(Object key)

Specified by:
remove in interface Map<K,V>

putAll

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

Specified by:
putAll in interface Map<K,V>

clear

public void clear()

Specified by:
clear in interface Map<K,V>

keySet

public Set<K> keySet()

Specified by:
keySet in interface Map<K,V>

values

public Collection<V> values()

Specified by:
values in interface Map<K,V>

entrySet

public Set<Map.Entry<K,V>> entrySet()

Specified by:
entrySet in interface Map<K,V>


Copyright © 2012. All Rights Reserved.