javax.cache
Interface Cache<K,V>

All Superinterfaces:
CacheLifecycle, java.lang.Iterable<Cache.Entry<K,V>>
All Known Subinterfaces:
ObjectCache<K,V>
All Known Implementing Classes:
AbstractCache, CacheImpl, ClusterCache, LocalCache, MemcachedClient, TransientCache

public interface Cache<K,V>
extends java.lang.Iterable<Cache.Entry<K,V>>, CacheLifecycle

The persistent or distributed cache is usable like a normal map, but loads and stores data across the cluster.


Nested Class Summary
static interface Cache.Entry<K,V>
           
static interface Cache.EntryProcessor<K,V>
           
static interface Cache.MutableEntry<K,V>
           
 
Method Summary
 boolean containsKey(K key)
           
 V get(java.lang.Object key)
          Returns the object specified by the given key.
 java.util.Map<K,V> getAll(java.util.Set<? extends K> keys)
           
 V getAndPut(K key, V value)
           
 V getAndRemove(K key)
           
 V getAndReplace(K key, V value)
           
 CacheManager getCacheManager()
           
 CacheConfiguration<K,V> getConfiguration()
           
 CacheMXBean getMBean()
           
 java.lang.String getName()
           
 CacheStatistics getStatistics()
           
 java.lang.Object invokeEntryProcessor(K key, Cache.EntryProcessor<K,V> entryProcessor)
           
 java.util.Iterator<Cache.Entry<K,V>> iterator()
           
 java.util.concurrent.Future<V> load(K key)
           
 java.util.concurrent.Future<java.util.Map<K,? extends V>> loadAll(java.util.Set<? extends K> keys)
           
 void put(K key, V value)
          Puts a new item in the cache.
 void putAll(java.util.Map<? extends K,? extends V> map)
           
 boolean putIfAbsent(K key, V value)
           
 boolean registerCacheEntryListener(CacheEntryListener<? super K,? super V> listener, Filter filter)
           
 boolean remove(K key)
           
 boolean remove(K key, V oldValue)
           
 void removeAll()
           
 void removeAll(java.util.Set<? extends K> keys)
           
 boolean replace(K key, V value)
           
 boolean replace(K key, V oldValue, V newValue)
           
 boolean unregisterCacheEntryListener(CacheEntryListener<?,?> listener)
           
<T> T
unwrap(java.lang.Class<T> cl)
           
 
Methods inherited from interface javax.cache.CacheLifecycle
getStatus, start, stop
 

Method Detail

get

V get(java.lang.Object key)
Returns the object specified by the given key.

If the item does not exist and a CacheLoader has been specified, the CacheLoader will be used to create a cache value.


getAll

java.util.Map<K,V> getAll(java.util.Set<? extends K> keys)

containsKey

boolean containsKey(K key)

load

java.util.concurrent.Future<V> load(K key)

loadAll

java.util.concurrent.Future<java.util.Map<K,? extends V>> loadAll(java.util.Set<? extends K> keys)

getStatistics

CacheStatistics getStatistics()

put

void put(K key,
         V value)
Puts a new item in the cache.

Parameters:
key - the key of the item to put
value - the value of the item to put

getAndPut

V getAndPut(K key,
            V value)

putAll

void putAll(java.util.Map<? extends K,? extends V> map)

putIfAbsent

boolean putIfAbsent(K key,
                    V value)

remove

boolean remove(K key)

remove

boolean remove(K key,
               V oldValue)

getAndRemove

V getAndRemove(K key)

replace

boolean replace(K key,
                V oldValue,
                V newValue)

replace

boolean replace(K key,
                V value)

getAndReplace

V getAndReplace(K key,
                V value)

removeAll

void removeAll(java.util.Set<? extends K> keys)

removeAll

void removeAll()

getConfiguration

CacheConfiguration<K,V> getConfiguration()

registerCacheEntryListener

boolean registerCacheEntryListener(CacheEntryListener<? super K,? super V> listener,
                                   Filter filter)

unregisterCacheEntryListener

boolean unregisterCacheEntryListener(CacheEntryListener<?,?> listener)

invokeEntryProcessor

java.lang.Object invokeEntryProcessor(K key,
                                      Cache.EntryProcessor<K,V> entryProcessor)

getName

java.lang.String getName()

getCacheManager

CacheManager getCacheManager()

unwrap

<T> T unwrap(java.lang.Class<T> cl)

iterator

java.util.Iterator<Cache.Entry<K,V>> iterator()
Specified by:
iterator in interface java.lang.Iterable<Cache.Entry<K,V>>

getMBean

CacheMXBean getMBean()