org.hibernate.cache.infinispan.util
Interface CacheAdapter

All Known Implementing Classes:
CacheAdapterImpl

public interface CacheAdapter

Infinispan cache abstraction.

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.
 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.
 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.
 

Method Detail

isClusteredInvalidation

boolean isClusteredInvalidation()
Is this cache participating in a cluster with invalidation?

Returns:
true if the cache is configured for synchronous/asynchronous invalidation; false otherwise.

isClusteredReplication

boolean isClusteredReplication()
Is this cache participating in a cluster with replication?

Returns:
true if the cache is configured for synchronous/asynchronous invalidation; false otherwise.

isSynchronous

boolean isSynchronous()
Is this cache configured for synchronous communication?

Returns:
true if the cache is configured for synchronous communication; false otherwise.

keySet

Set keySet()
Set of keys of this cache.

Returns:
Set containing keys stored in this cache.

withFlags

CacheAdapter withFlags(FlagAdapter... flagAdapters)
A builder-style method that adds flags to any cache API call.

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

containsKey

boolean containsKey(Object key)
Method to check whether a certain key exists in this cache.

Parameters:
key - key to look up.
Returns:
true if key is present, false otherwise.

get

Object get(Object key)
           throws CacheException
Performs an get(Object) on the cache, wrapping any exception in a CacheException.

Parameters:
key - key to retrieve
Throws:
CacheException

getAllowingTimeout

Object getAllowingTimeout(Object key)
                          throws CacheException
Performs an get(Object) on the cache ignoring any TimeoutException and wrapping any other exception in a CacheException.

Parameters:
key - key to retrieve
Throws:
CacheException

put

Object put(Object key,
           Object value)
           throws CacheException
Performs a put(Object, Object) on the cache, wrapping any exception in a CacheException.

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

Object putAllowingTimeout(Object key,
                          Object value)
                          throws CacheException
Performs a put(Object, Object) on the cache ignoring any TimeoutException and wrapping any exception in a CacheException.

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

void putForExternalRead(Object key,
                        Object value)
                        throws CacheException
See Cache.putForExternalRead(Object, Object) for detailed documentation.

Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Throws:
CacheException

remove

Object remove(Object key)
              throws CacheException
Performs a remove(Object), wrapping any exception in a CacheException.

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

void evict(Object key)
           throws CacheException
Evict the given key from memory.

Parameters:
key - to evict.
Throws:
CacheException

clear

void clear()
           throws CacheException
Clear the cache.

Throws:
CacheException

stop

void stop()
Stops the cache.


addListener

void addListener(Object listener)
Add listener to this cache.

Parameters:
listener - to be added to cache.

getAddress

AddressAdapter getAddress()
Get local cluster address.

Returns:
Address representing local address.

getMembers

List<AddressAdapter> getMembers()
Get cluster members.

Returns:
List of cluster member Address instances

size

int size()
Size of cache.

Returns:
number of cache entries.

toMap

Map toMap()
This method returns a Map view of the cache.

Returns:
Map view of cache.

removeListener

void removeListener(Object listener)
Remove listener from cache instance.

Parameters:
listener - to be removed.

getConfiguration

org.infinispan.config.Configuration getConfiguration()
Get cache configuration.

Returns:
Configuration instance associated with this cache.


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