VMware GemFire Java API Reference
Package org.apache.geode.cache
Interface Region.Entry<K,V>
-
- All Superinterfaces:
java.util.Map.Entry<K,V>
public static interface Region.Entry<K,V> extends java.util.Map.Entry<K,V>A key-value pair containing the cached data in a region. This object's operations (except for{Entry#setValue()}), are not distributed, do not acquire any locks, and do not affectCacheStatistics.Unless otherwise noted, all of these methods throw a
CacheClosedExceptionif the Cache is closed at the time of invocation, or anEntryDestroyedExceptionif the entry has been destroyed.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description KgetKey()Returns the key for this entry.Region<K,V>getRegion()Returns the region that contains this entry.CacheStatisticsgetStatistics()Returns the statistics for this entry.java.lang.ObjectgetUserAttribute()Returns the user attribute for this entry in the local cache.VgetValue()Returns the value of this entry in the local cache.booleanisDestroyed()Returns whether this entry has been destroyed.booleanisLocal()This method checks to see if the entry is in the in-process cache, or is in another process.java.lang.ObjectsetUserAttribute(java.lang.Object userAttribute)Sets the user attribute for this entry.VsetValue(V value)Sets the value of this entry.
-
-
-
Method Detail
-
getKey
K getKey()
Returns the key for this entry.
-
getValue
V getValue()
Returns the value of this entry in the local cache. Does not invoke aCacheLoader, does not do a netSearch, netLoad, etc.
-
getRegion
Region<K,V> getRegion()
Returns the region that contains this entry.- Returns:
- the Region that contains this entry
-
isLocal
boolean isLocal()
This method checks to see if the entry is in the in-process cache, or is in another process. Only Regions withDataPolicy.PARTITIONmay return false in response to this query. A non-local Entry will not reflect dynamic changes being made to the cache. For instance, the result of getValue() will not change, even though the cache may have been updated for the corresponding key. To see an updated snapshot of a non-local Entry, you must fetch the entry from the Region again.- Returns:
- whether the entry is in the in-process cache, or is in another process
-
getStatistics
CacheStatistics getStatistics()
Returns the statistics for this entry.- Returns:
- the CacheStatistics for this entry
- Throws:
StatisticsDisabledException- if statistics have been disabled for this region
-
getUserAttribute
java.lang.Object getUserAttribute()
Returns the user attribute for this entry in the local cache.- Returns:
- the user attribute for this entry
-
setUserAttribute
java.lang.Object setUserAttribute(java.lang.Object userAttribute)
Sets the user attribute for this entry. Does not distribute the user attribute to other caches.- Parameters:
userAttribute- the user attribute for this entry- Returns:
- the previous user attribute or null no user attributes has been set for this entry
-
isDestroyed
boolean isDestroyed()
Returns whether this entry has been destroyed.Does not throw a
EntryDestroyedExceptionif this entry has been destroyed.- Returns:
- true if this entry has been destroyed
-
setValue
V setValue(V value)
Sets the value of this entry. It has similar to calling a put on the key of this Entry- Specified by:
setValuein interfacejava.util.Map.Entry<K,V>- Parameters:
value- Object the value to be set- Returns:
- the previous value object stored locally for this entry. If the entry did not exist
then
nullis returned. If the entry was "invalid" thennullis returned. In some casesnullmay be returned even if a previous value exists. If the region is a client proxy thennullis returned. If the region is off-heap and the old value was stored in off-heap memory thennullis returned. If the region is partitioned and the setValue is done on a non-primary thennullis returned. If the value is not currently stored in memory but is on disk and if the region does not have cqs thennullis returned. - Since:
- GemFire 5.0
- See Also:
Region.put(Object, Object)
-
-