public interface Cache<K,V> extends BasicCache<K,V>, Listenable
OutOfMemoryErrorsCacheStore, either when they are evicted as an overflow,
 or all the time, to maintain persistent copies that would withstand server failure or restarts.ConcurrentMap and implements all methods accordingly, although methods like
 Map.keySet(), Map.values() and Map.entrySet() are expensive
 (prohibitively so when using a distributed cache) and frequent use of these methods is not recommended.
  
 Map.size() provides the size of the local, internal data container only.  This does not take into account
 in-fly transactions, entries stored in a cache store, or remote entries.  It may also take into consideration
 entries that have expired but haven't yet been removed from the internal container, as well as entries in the L1
 cache if L1 is enabled along with distribution as a clustering mode.  See the Infinispan User Guide section on
 L1 caching for more details.
 
 Also, like many ConcurrentMap implementations, Cache does not support the use of null keys or
 values.
 
 BasicCache.putAsync(Object, Object) offer the best of both worlds
 between a fully synchronous and a fully asynchronous cache in that a NotifyingFuture is returned.  The
 NotifyingFuture can then be ignored or thrown away for typical asynchronous behaviour, or queried for
 synchronous behaviour, which would block until any remote calls complete.  Note that all remote calls are, as far as
 the transport is concerned, synchronous.  This allows you the guarantees that remote calls succeed, while not
 blocking your application thread unnecessarily.  For example, usage such as the following could benefit from the
 async operations:
 
   NotifyingFuture f1 = cache.putAsync("key1", "value1");
   NotifyingFuture f2 = cache.putAsync("key2", "value2");
   NotifyingFuture f3 = cache.putAsync("key3", "value3");
   f1.get();
   f2.get();
   f3.get();
 
 The net result is behavior similar to synchronous RPC calls in that at the end, you have guarantees that all calls
 completed successfully, but you have the added benefit that the three calls could happen in parallel.  This is
 especially advantageous if the cache uses distribution and the three keys map to different cache instances in the
 cluster.
 
 Also, the use of async operations when within a transaction return your local value only, as expected.  A
 NotifyingFuture is still returned though for API consistency.
 
 CacheContainer.
 CacheManager cm = new DefaultCacheManager(); // optionally pass in a default configuration Cache c = cm.getCache();See the
CacheContainer interface for more details on providing specific configurations, using multiple caches
 in the same JVM, etc.
 
 Please see the Infinispan documentation and/or the 5 Minute Usage Tutorial for more details.
 CacheContainer, 
DefaultCacheManager, 
Infinispan documentation, 
5 Minute Usage Tutorial| Modifier and Type | Method and Description | 
|---|---|
void | 
compact()
Method that releases object references of cached objects held in the cache by serializing them to byte buffers. 
 | 
void | 
endBatch(boolean successful)
Completes a batch if one has been started using  
startBatch(). | 
Set<Map.Entry<K,V>> | 
entrySet()
Returns a set view of the mappings contained in this cache. 
 | 
void | 
evict(K key)
Evicts an entry from the memory of the cache. 
 | 
AdvancedCache<K,V> | 
getAdvancedCache()  | 
Configuration | 
getCacheConfiguration()  | 
EmbeddedCacheManager | 
getCacheManager()
Retrieves the cache manager responsible for creating this cache instance. 
 | 
Configuration | 
getConfiguration()
Deprecated.  
 | 
ComponentStatus | 
getStatus()  | 
Set<K> | 
keySet()
Returns a set view of the keys contained in this cache. 
 | 
void | 
putForExternalRead(K key,
                  V value)
Under special operating behavior, associates the value with the specified key. 
 | 
boolean | 
startBatch()
Starts a batch. 
 | 
Collection<V> | 
values()
Returns a collection view of the values contained in this cache. 
 | 
clearAsync, getAsync, getName, getVersion, put, put, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, removeAsync, removeAsync, replace, replace, replace, replace, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsyncputIfAbsent, remove, replace, replaceclear, containsKey, containsValue, equals, get, hashCode, isEmpty, put, putAll, remove, sizeaddListener, getListeners, removeListenervoid putForExternalRead(K key, V value)
ConcurrentMap.putIfAbsent(Object, Object))
 key - key with which the specified value is to be associated.value - value to be associated with the specified key.IllegalStateException - if getStatus() would not return ComponentStatus.RUNNING.void evict(K key)
Map.remove(Object) to remove an
 entry from the entire cache system.
 
 This method is designed to evict an entry from memory to free up memory used by the application.  This method uses
 a 0 lock acquisition timeout so it does not block in attempting to acquire locks.  It behaves as a no-op if the
 lock on the entry cannot be acquired immediately.
 
 Important: this method should not be called from within a transaction scope.key - key to evict@Deprecated Configuration getConfiguration()
Configuration getCacheConfiguration()
boolean startBatch()
void endBatch(boolean successful)
startBatch().  If no batch has been started, this is a
 no-op.
 successful - if true, the batch completes, otherwise the batch is aborted and changes are not committed.EmbeddedCacheManager getCacheManager()
AdvancedCache<K,V> getAdvancedCache()
void compact()
ComponentStatus getStatus()
Set<K> keySet()
Collection<V> values()
Set<Map.Entry<K,V>> entrySet()
Map.Entry. When this method is called on a cache configured with distribution mode, the set returned only 
 contains the mappings locally available in the cache instance. To avoid memory issues, there will be not attempt 
 to bring mappings from other nodes.
 
 This method should only be used for debugging purposes such as to verify that the cache contains all the mappings 
 entered. Any other use involving execution of this method on a production system is not recommended.
 Copyright © 2012 JBoss by Red Hat. All Rights Reserved.