org.hibernate.cache.infinispan.util
Class CacheAdapterImpl

java.lang.Object
  extended by org.hibernate.cache.infinispan.util.CacheAdapterImpl
All Implemented Interfaces:
CacheAdapter

public class CacheAdapterImpl
extends Object
implements CacheAdapter

CacheAdapterImpl.

Since:
3.5
Author:
Galder ZamarreƱo

Method Summary
 void addListener(Object listener)
          Add listener to this cache.
 void clear()
          Clear the cache.
 boolean containsKey(Object key)
          Method to check whether a certain key exists in this cache.
 void evict(Object key)
          Evict the given key from memory.
 Object get(Object key)
          Performs an get(Object) on the cache, wrapping any exception in a CacheException.
 AddressAdapter getAddress()
          Get local cluster address.
 Object getAllowingTimeout(Object key)
          Performs an get(Object) on the cache ignoring any TimeoutException and wrapping any other exception in a CacheException.
 org.infinispan.config.Configuration getConfiguration()
          Get cache configuration.
 List<AddressAdapter> getMembers()
          Get cluster members.
 org.infinispan.remoting.rpc.RpcManager getRpcManager()
           
 boolean isClusteredInvalidation()
          Is this cache participating in a cluster with invalidation?
 boolean isClusteredReplication()
          Is this cache participating in a cluster with replication?
 boolean isSynchronous()
          Is this cache configured for synchronous communication?
 Set keySet()
          Set of keys of this cache.
static CacheAdapter newInstance(org.infinispan.Cache cache)
           
 Object put(Object key, Object value)
          Performs a put(Object, Object) on the cache, wrapping any exception in a CacheException.
 Object putAllowingTimeout(Object key, Object value)
          Performs a put(Object, Object) on the cache ignoring any TimeoutException and wrapping any exception in a CacheException.
 void putForExternalRead(Object key, Object value)
          See Cache.putForExternalRead(Object, Object) for detailed documentation.
 Object remove(Object key)
          Performs a remove(Object), wrapping any exception in a CacheException.
 void removeListener(Object listener)
          Remove listener from cache instance.
 int size()
          Size of cache.
 void stop()
          Stops the cache.
 Map toMap()
          This method returns a Map view of the cache.
 CacheAdapter withFlags(FlagAdapter... flagAdapters)
          A builder-style method that adds flags to any cache API call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static CacheAdapter newInstance(org.infinispan.Cache cache)

isClusteredInvalidation

public boolean isClusteredInvalidation()
Description copied from interface: CacheAdapter
Is this cache participating in a cluster with invalidation?

Specified by:
isClusteredInvalidation in interface CacheAdapter
Returns:
true if the cache is configured for synchronous/asynchronous invalidation; false otherwise.

isClusteredReplication

public boolean isClusteredReplication()
Description copied from interface: CacheAdapter
Is this cache participating in a cluster with replication?

Specified by:
isClusteredReplication in interface CacheAdapter
Returns:
true if the cache is configured for synchronous/asynchronous invalidation; false otherwise.

isSynchronous

public boolean isSynchronous()
Description copied from interface: CacheAdapter
Is this cache configured for synchronous communication?

Specified by:
isSynchronous in interface CacheAdapter
Returns:
true if the cache is configured for synchronous communication; false otherwise.

keySet

public Set keySet()
Description copied from interface: CacheAdapter
Set of keys of this cache.

Specified by:
keySet in interface CacheAdapter
Returns:
Set containing keys stored in this cache.

withFlags

public CacheAdapter withFlags(FlagAdapter... flagAdapters)
Description copied from interface: CacheAdapter
A builder-style method that adds flags to any cache API call.

Specified by:
withFlags in interface CacheAdapter
Parameters:
flagAdapters - a set of flags to apply. See the FlagAdapter documentation.
Returns:
a cache on which a real operation is to be invoked.

get

public Object get(Object key)
           throws CacheException
Description copied from interface: CacheAdapter
Performs an get(Object) on the cache, wrapping any exception in a CacheException.

Specified by:
get in interface CacheAdapter
Parameters:
key - key to retrieve
Throws:
CacheException

getAllowingTimeout

public Object getAllowingTimeout(Object key)
                          throws CacheException
Description copied from interface: CacheAdapter
Performs an get(Object) on the cache ignoring any TimeoutException and wrapping any other exception in a CacheException.

Specified by:
getAllowingTimeout in interface CacheAdapter
Parameters:
key - key to retrieve
Throws:
CacheException

put

public Object put(Object key,
                  Object value)
           throws CacheException
Description copied from interface: CacheAdapter
Performs a put(Object, Object) on the cache, wrapping any exception in a CacheException.

Specified by:
put in interface CacheAdapter
Parameters:
key - key whose value will be modified
value - data to store in the cache entry
Returns:
the previous value associated with key, or null if there was no mapping for key.
Throws:
CacheException

putAllowingTimeout

public Object putAllowingTimeout(Object key,
                                 Object value)
                          throws CacheException
Description copied from interface: CacheAdapter
Performs a put(Object, Object) on the cache ignoring any TimeoutException and wrapping any exception in a CacheException.

Specified by:
putAllowingTimeout in interface CacheAdapter
Parameters:
key - key whose value will be modified
value - data to store in the cache entry
Returns:
the previous value associated with key, or null if there was no mapping for key.
Throws:
CacheException

putForExternalRead

public void putForExternalRead(Object key,
                               Object value)
                        throws CacheException
Description copied from interface: CacheAdapter
See Cache.putForExternalRead(Object, Object) for detailed documentation.

Specified by:
putForExternalRead in interface CacheAdapter
Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Throws:
CacheException

remove

public Object remove(Object key)
              throws CacheException
Description copied from interface: CacheAdapter
Performs a remove(Object), wrapping any exception in a CacheException.

Specified by:
remove in interface CacheAdapter
Parameters:
key - key to be removed
Returns:
the previous value associated with key, or null if there was no mapping for key.
Throws:
CacheException

evict

public void evict(Object key)
           throws CacheException
Description copied from interface: CacheAdapter
Evict the given key from memory.

Specified by:
evict in interface CacheAdapter
Parameters:
key - to evict.
Throws:
CacheException

clear

public void clear()
           throws CacheException
Description copied from interface: CacheAdapter
Clear the cache.

Specified by:
clear in interface CacheAdapter
Throws:
CacheException

stop

public void stop()
Description copied from interface: CacheAdapter
Stops the cache.

Specified by:
stop in interface CacheAdapter

addListener

public void addListener(Object listener)
Description copied from interface: CacheAdapter
Add listener to this cache.

Specified by:
addListener in interface CacheAdapter
Parameters:
listener - to be added to cache.

getAddress

public AddressAdapter getAddress()
Description copied from interface: CacheAdapter
Get local cluster address.

Specified by:
getAddress in interface CacheAdapter
Returns:
Address representing local address.

getMembers

public List<AddressAdapter> getMembers()
Description copied from interface: CacheAdapter
Get cluster members.

Specified by:
getMembers in interface CacheAdapter
Returns:
List of cluster member Address instances

getRpcManager

public org.infinispan.remoting.rpc.RpcManager getRpcManager()

size

public int size()
Description copied from interface: CacheAdapter
Size of cache.

Specified by:
size in interface CacheAdapter
Returns:
number of cache entries.

toMap

public Map toMap()
Description copied from interface: CacheAdapter
This method returns a Map view of the cache.

Specified by:
toMap in interface CacheAdapter
Returns:
Map view of cache.

removeListener

public void removeListener(Object listener)
Description copied from interface: CacheAdapter
Remove listener from cache instance.

Specified by:
removeListener in interface CacheAdapter
Parameters:
listener - to be removed.

containsKey

public boolean containsKey(Object key)
Description copied from interface: CacheAdapter
Method to check whether a certain key exists in this cache.

Specified by:
containsKey in interface CacheAdapter
Parameters:
key - key to look up.
Returns:
true if key is present, false otherwise.

getConfiguration

public org.infinispan.config.Configuration getConfiguration()
Description copied from interface: CacheAdapter
Get cache configuration.

Specified by:
getConfiguration in interface CacheAdapter
Returns:
Configuration instance associated with this cache.


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.