org.castor.cache.distributed
Class OsCache<K,V>

java.lang.Object
  extended by org.castor.cache.AbstractBaseCache<K,V>
      extended by org.castor.cache.distributed.AbstractDistributedCache<K,V>
          extended by org.castor.cache.distributed.OsCache<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 OsCache<K,V>
extends AbstractDistributedCache<K,V>

OSCache (opensymphony) implementation of Castor JDO Cache. For more details of OSCache, see http://www.opensymphony.com/oscache

Since:
1.0
Version:
$Revision: 9041 $ $Date: 2011-08-16 11:51:17 +0200 (Di, 16 Aug 2011) $
Author:
Werner Guttmann, Ralf Joachim
See Also:
The OSCache Home page

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static String IMPLEMENTATION
          The classname of the implementations cache class.
static String NEEDS_REFRESH_EXCEPTION
          Classname of exception thrown by getFromCache() method of oscache.
static String TYPE
          The type of the cache.
 
Fields inherited from interface org.castor.cache.Cache
DEFAULT_DEBUG, DEFAULT_NAME, DEFAULT_TYPE, PARAM_DEBUG, PARAM_NAME, PARAM_TYPE
 
Constructor Summary
OsCache(Object cache)
          Construct an instance of OsCache that wrapps access to given cache implementation of class com.opensymphony.oscache.general.GeneralCacheAdministrator.
 
Method Summary
 void clear()
          
 boolean containsKey(Object key)
          
 boolean containsValue(Object value)
          
 Set<Map.Entry<K,V>> entrySet()
          
 V get(Object key)
          
 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 org.castor.cache.distributed.AbstractDistributedCache
getCache, invokeMethod, invokeStaticMethod, setCache
 
Methods inherited from class org.castor.cache.AbstractBaseCache
close, expire, expireAll, getName
 
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
 

Field Detail

TYPE

public static final String TYPE
The type of the cache.

See Also:
Constant Field Values

IMPLEMENTATION

public static final String IMPLEMENTATION
The classname of the implementations cache class.

See Also:
Constant Field Values

NEEDS_REFRESH_EXCEPTION

public static final String NEEDS_REFRESH_EXCEPTION
Classname of exception thrown by getFromCache() method of oscache.

See Also:
Constant Field Values
Constructor Detail

OsCache

public OsCache(Object cache)
Construct an instance of OsCache that wrapps access to given cache implementation of class com.opensymphony.oscache.general.GeneralCacheAdministrator.

Parameters:
cache - The cache to be wrapped.
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>
Overrides:
initialize in class AbstractBaseCache<K,V>
Parameters:
params - Parameters to initialize the cache (e.g. name, capacity).
Throws:
CacheAcquireException - If cache can not be initialized.

getType

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

Returns:
The cache type.

size

public int size()

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

isEmpty

public boolean isEmpty()

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

containsKey

public boolean containsKey(Object key)

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

containsValue

public boolean containsValue(Object value)

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

get

public V get(Object key)

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

put

public V put(K key,
             V value)

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

remove

public V remove(Object key)

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

putAll

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

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

clear

public void clear()

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

keySet

public Set<K> keySet()

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

values

public Collection<V> values()

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

entrySet

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

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


Copyright © 2012. All Rights Reserved.