Returns the value for the given key, passing the callback argument to any cache loaders or cache writers that are invoked in the operation.

Namespace: GemStone.GemFire.Cache
Assembly:  GemStone.GemFire.Cache (in GemStone.GemFire.Cache.dll)


public IGFSerializable Get(
	ICacheableKey key,
	IGFSerializable callback
Visual Basic (Declaration)
Public Function Get ( _
	key As ICacheableKey, _
	callback As IGFSerializable _
) As IGFSerializable
Visual C++
IGFSerializable^ Get (
	ICacheableKey^ key, 
	IGFSerializable^ callback


key whose associated value is to be returned -- the key object must implement the equals and hashcode methods.
An argument passed into the CacheLoader if loader is used -- will also be subsequently passed to a CacheWriter if the loader returns a non-null value to be placed in the cache. Modifications to this argument made in the CacheLoader will be visible to the CacheWriter, even if the loader and the writer are installed in different cache processes. Can be null.

Return Value

value, or null if the value is not found and can't be loaded



If the value is not present locally for this entry, a netSearch and/or a CacheLoader may be invoked to get the value, depending on the scope of this region. A netSearch looks for a value in every node of the system that defines this region. A netLoad invokes remote loaders one at a time until one returns a value or throws an exception. If any of these methods successfully retrieves a value, then the value is immediately returned.

For local scope, a local CacheLoader will be invoked if there is one. For any distributed scope, the order is localLoad, netSearch, netLoad.

netSearch and netLoad are never performed more than once. If a loader attempts a second netSearch, it will not be done.

@endcacheserver @nativeclient

If the value is not present locally then it is requested from the java server. If even that is unsuccessful then a local CacheLoader will be invoked if there is one.


The value returned by get is not copied, so multi-threaded applications should not modify the value directly, but should use the update methods.

Updates the LastAccessedTime and LastModifiedTime (if a new value is loaded) for this region and the entry.

If an ICacheWriter throws a CacheWriterException when a new value is retrieved from a loader, then the value will not be put into the cache (a new entry will not be created) but the get will return the value and not propagate the exception.


GemStone.GemFire.Cache..::IllegalArgumentException if key is null
GemStone.GemFire.Cache..::CacheServerException If an exception is received from the Java cache server. Only for Native Client regions.
GemStone.GemFire.Cache..::NotConnectedException if not connected to the GemFire system because the client cannot establish usable connections to any of the servers given to it.
GemStone.GemFire.Cache..::MessageException If the message received from server could not be handled. This will be the case when an unregistered typeId is received in the reply or reply is not well formed. More information can be found in the log.
GemStone.GemFire.Cache..::TimeoutException if the operation timed out
GemStone.GemFire.Cache..::RegionDestroyedException if this region has been destroyed

See Also