org.ehcache.jcache
Class JCache<K,V>

java.lang.Object
  extended by org.ehcache.jcache.JCache<K,V>
Type Parameters:
K - the type of keys used by this JCache
V - the type of values that are loaded by this JCache
All Implemented Interfaces:
Closeable, Iterable<javax.cache.Cache.Entry<K,V>>, javax.cache.Cache<K,V>

public class JCache<K,V>
extends Object
implements javax.cache.Cache<K,V>

Implementation of a Cache that wraps an underlying ehcache.

Since:
1.4.0-beta1
Author:
Ryan Gardner

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.cache.Cache
javax.cache.Cache.Entry<K,V>
 
Constructor Summary
JCache(JCacheManager cacheManager, JCacheConfiguration<K,V> cfg, net.sf.ehcache.Ehcache ehcache)
           
 
Method Summary
 void clear()
           
 void close()
           
 boolean containsKey(K key)
           
 void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
           
 V get(K key)
           
 Map<K,V> getAll(Set<? extends K> keys)
           
 V getAndPut(K key, V value)
           
 V getAndRemove(K key)
           
 V getAndReplace(K key, V value)
           
 javax.cache.CacheManager getCacheManager()
           
<C extends javax.cache.configuration.Configuration<K,V>>
C
getConfiguration(Class<C> clazz)
           
 String getName()
           
<T> T
invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
           
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>>
invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments)
           
 boolean isClosed()
           
 Iterator<javax.cache.Cache.Entry<K,V>> iterator()
           
 void loadAll(Set<? extends K> keys, boolean replaceExistingValues, javax.cache.integration.CompletionListener completionListener)
           
 void put(K key, V value)
           
 void putAll(Map<? extends K,? extends V> map)
           
 boolean putIfAbsent(K key, V value)
           
 void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
           
 boolean remove(K key)
           
 boolean remove(K key, V oldValue)
           
 void removeAll()
           
 void removeAll(Set<? extends K> keys)
           
 boolean replace(K key, V value)
           
 boolean replace(K key, V oldValue, V newValue)
           
<T> T
unwrap(Class<T> clazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCache

public JCache(JCacheManager cacheManager,
              JCacheConfiguration<K,V> cfg,
              net.sf.ehcache.Ehcache ehcache)
Method Detail

get

public V get(K key)
Specified by:
get in interface javax.cache.Cache<K,V>

getAll

public Map<K,V> getAll(Set<? extends K> keys)
Specified by:
getAll in interface javax.cache.Cache<K,V>

containsKey

public boolean containsKey(K key)
Specified by:
containsKey in interface javax.cache.Cache<K,V>

loadAll

public void loadAll(Set<? extends K> keys,
                    boolean replaceExistingValues,
                    javax.cache.integration.CompletionListener completionListener)
Specified by:
loadAll in interface javax.cache.Cache<K,V>

put

public void put(K key,
                V value)
Specified by:
put in interface javax.cache.Cache<K,V>

getAndPut

public V getAndPut(K key,
                   V value)
Specified by:
getAndPut in interface javax.cache.Cache<K,V>

putAll

public void putAll(Map<? extends K,? extends V> map)
Specified by:
putAll in interface javax.cache.Cache<K,V>

putIfAbsent

public boolean putIfAbsent(K key,
                           V value)
Specified by:
putIfAbsent in interface javax.cache.Cache<K,V>

remove

public boolean remove(K key)
Specified by:
remove in interface javax.cache.Cache<K,V>

remove

public boolean remove(K key,
                      V oldValue)
Specified by:
remove in interface javax.cache.Cache<K,V>

getAndRemove

public V getAndRemove(K key)
Specified by:
getAndRemove in interface javax.cache.Cache<K,V>

replace

public boolean replace(K key,
                       V oldValue,
                       V newValue)
Specified by:
replace in interface javax.cache.Cache<K,V>

replace

public boolean replace(K key,
                       V value)
Specified by:
replace in interface javax.cache.Cache<K,V>

getAndReplace

public V getAndReplace(K key,
                       V value)
Specified by:
getAndReplace in interface javax.cache.Cache<K,V>

removeAll

public void removeAll(Set<? extends K> keys)
Specified by:
removeAll in interface javax.cache.Cache<K,V>

removeAll

public void removeAll()
Specified by:
removeAll in interface javax.cache.Cache<K,V>

clear

public void clear()
Specified by:
clear in interface javax.cache.Cache<K,V>

getConfiguration

public <C extends javax.cache.configuration.Configuration<K,V>> C getConfiguration(Class<C> clazz)
Specified by:
getConfiguration in interface javax.cache.Cache<K,V>

invoke

public <T> T invoke(K key,
                    javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                    Object... arguments)
         throws javax.cache.processor.EntryProcessorException
Specified by:
invoke in interface javax.cache.Cache<K,V>
Throws:
javax.cache.processor.EntryProcessorException

invokeAll

public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys,
                                                                          javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                                          Object... arguments)
Specified by:
invokeAll in interface javax.cache.Cache<K,V>

getName

public String getName()
Specified by:
getName in interface javax.cache.Cache<K,V>

getCacheManager

public javax.cache.CacheManager getCacheManager()
Specified by:
getCacheManager in interface javax.cache.Cache<K,V>

close

public void close()
Specified by:
close in interface Closeable
Specified by:
close in interface javax.cache.Cache<K,V>

isClosed

public boolean isClosed()
Specified by:
isClosed in interface javax.cache.Cache<K,V>

unwrap

public <T> T unwrap(Class<T> clazz)
Specified by:
unwrap in interface javax.cache.Cache<K,V>

registerCacheEntryListener

public void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Specified by:
registerCacheEntryListener in interface javax.cache.Cache<K,V>

deregisterCacheEntryListener

public void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> cacheEntryListenerConfiguration)
Specified by:
deregisterCacheEntryListener in interface javax.cache.Cache<K,V>

iterator

public Iterator<javax.cache.Cache.Entry<K,V>> iterator()
Specified by:
iterator in interface Iterable<javax.cache.Cache.Entry<K,V>>
Specified by:
iterator in interface javax.cache.Cache<K,V>


Copyright © 2014 Terracotta. All Rights Reserved.