public class JCacheCache extends Object implements org.springframework.cache.Cache
Cache
implementation on top of a
Cache
instance.
Note: This class has been updated for JCache 1.0, as of Spring 4.0.
Constructor and Description |
---|
JCacheCache(javax.cache.Cache<Object,Object> jcache)
Create an
JCacheCache instance. |
JCacheCache(javax.cache.Cache<Object,Object> jcache,
boolean allowNullValues)
Create an
JCacheCache instance. |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
evict(Object key) |
protected Object |
fromStoreValue(Object storeValue)
Convert the given value from the internal store to a user value
returned from the get method (adapting
null ). |
org.springframework.cache.Cache.ValueWrapper |
get(Object key) |
<T> T |
get(Object key,
Class<T> type) |
String |
getName() |
javax.cache.Cache<Object,Object> |
getNativeCache() |
boolean |
isAllowNullValues() |
void |
put(Object key,
Object value) |
org.springframework.cache.Cache.ValueWrapper |
putIfAbsent(Object key,
Object value) |
protected Object |
toStoreValue(Object userValue)
Convert the given user value, as passed into the put method,
to a value in the internal store (adapting
null ). |
public JCacheCache(javax.cache.Cache<Object,Object> jcache)
JCacheCache
instance.jcache
- backing JCache Cache instancepublic JCacheCache(javax.cache.Cache<Object,Object> jcache, boolean allowNullValues)
JCacheCache
instance.jcache
- backing JCache Cache instanceallowNullValues
- whether to accept and convert null values for this cachepublic final String getName()
getName
in interface org.springframework.cache.Cache
public final javax.cache.Cache<Object,Object> getNativeCache()
getNativeCache
in interface org.springframework.cache.Cache
public final boolean isAllowNullValues()
public org.springframework.cache.Cache.ValueWrapper get(Object key)
get
in interface org.springframework.cache.Cache
public <T> T get(Object key, Class<T> type)
get
in interface org.springframework.cache.Cache
public void put(Object key, Object value)
put
in interface org.springframework.cache.Cache
public org.springframework.cache.Cache.ValueWrapper putIfAbsent(Object key, Object value)
putIfAbsent
in interface org.springframework.cache.Cache
public void evict(Object key)
evict
in interface org.springframework.cache.Cache
public void clear()
clear
in interface org.springframework.cache.Cache
protected Object fromStoreValue(Object storeValue)
null
).storeValue
- the store value