Cache.ValueRetrievalException, Cache.ValueWrapper
Constructor and Description |
---|
GemfireCache(org.apache.geode.cache.Region<?,?> region)
Constructs an instance of
GemFireCache initialized with the given GemFire Region . |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the entire contents of this Spring
Cache . |
void |
evict(Object key)
Evicts (destroys) the entry (key/value) mapped to the given key from this Spring
Cache . |
Cache.ValueWrapper |
get(Object key)
Returns the cache value for the given key wrapped in an instance of
Cache.ValueWrapper . |
<T> T |
get(Object key,
Callable<T> valueLoader)
Returns the cache value for given key.
|
<T> T |
get(Object key,
Class<T> type)
Returns the cache value for the given key cast to the specified
Class type. |
String |
getName()
Returns the name of this Spring
Cache . |
org.apache.geode.cache.Region |
getNativeCache()
Returns the GemFire
Region used as the implementation for this Spring Cache . |
void |
put(Object key,
Object value)
Stores the given value in the cache referenced by the given key.
|
Cache.ValueWrapper |
putIfAbsent(Object key,
Object value)
Implementation of
Cache.putIfAbsent(Object, Object) satisfying the extension of
the Cache interface in Spring 4.1. |
static GemfireCache |
wrap(org.apache.geode.cache.Region<?,?> region)
Wraps a GemFire
Region in an instance of GemfireCache to adapt the GemFire Region
to function as a Spring Cache in Spring's caching infrastructure. |
public GemfireCache(org.apache.geode.cache.Region<?,?> region)
GemFireCache
initialized with the given GemFire Region
.
The Region
will function as the backing store and implementation for
the Spring Cache
interface.region
- GemFire Region
backing the Spring Cache
.IllegalArgumentException
- if Region
is null.public static GemfireCache wrap(org.apache.geode.cache.Region<?,?> region)
Region
in an instance of GemfireCache
to adapt the GemFire Region
to function as a Spring Cache
in Spring's caching infrastructure.region
- GemFire Region
to wrap.GemfireCache
backed by the provided GemFire Region
.Region
,
Cache
,
GemfireCache(Region)
public org.apache.geode.cache.Region getNativeCache()
Region
used as the implementation for this Spring Cache
.getNativeCache
in interface Cache
Region
used as the implementation for this Spring Cache
.Region
public void clear()
Cache
.public void evict(Object key)
Cache
.public Cache.ValueWrapper get(Object key)
Cache.ValueWrapper
.get
in interface Cache
key
- key identifying the the value to retrieve from the cache.Cache.ValueWrapper
,
Region.get(Object)
public <T> T get(Object key, Class<T> type)
Class
type.get
in interface Cache
T
- desired Class
type of the cache value.key
- key identifying the the value to retrieve from the cache.type
- desired Class
type of the value.Class
type.IllegalStateException
- if the value is not null and not an instance of the desired type.Region.get(Object)
public <T> T get(Object key, Callable<T> valueLoader)
Callable
valueLoader
will be called to obtain a value and add the entry
to this cache.get
in interface Cache
T
- Class
type of the value.key
- key identifying the the value to retrieve from the cache.valueLoader
- Callable
object used to load a value if the entry identified by the key
does not already have value.Callable
object
if the value for key is null.Cache.ValueRetrievalException
- if an error occurs while trying to
load a value for given key using the Callable
.get(Object, Class)
public void put(Object key, Object value)
public Cache.ValueWrapper putIfAbsent(Object key, Object value)
Cache.putIfAbsent(Object, Object)
satisfying the extension of
the Cache
interface in Spring 4.1. Don't add the Override
annotation
otherwise this will break the compilation on 4.0.putIfAbsent
in interface Cache
Cache.putIfAbsent(java.lang.Object, java.lang.Object)
,
Region.putIfAbsent(Object, Object)
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.