VMware GemFire Native Client .NET Framework API Reference
|
VMware VMware GemFire Native .NET Reference 10.4.3
|
Encapsulates a concrete region of cached data. More...
#include <IRegion.hpp>
Inherits System::Collections::Generic::IDictionary< TKey, TValue >.
Inherited by Apache::Geode::Client::LocalRegion< TKey, TValue >, and Apache::Geode::Client::Region< TKey, TValue >.
Public Member Functions | |
| bool | ContainsValueForKey (TKey key) |
| True if the region contains a value for the given key. | |
| IRegion< TKey, TValue > ^ | CreateSubRegion (String^ subRegionName, RegionAttributes< TKey, TValue >^ attributes) |
| Creates a subregion with the given name and attributes. | |
| void | DestroyRegion () |
Destroys the whole distributed region and provides a user-defined parameter object to any ICacheWriter invoked in the process. | |
| void | DestroyRegion (Object^ callbackArg) |
Destroys the whole distributed region and provides a user-defined parameter object to any ICacheWriter invoked in the process. | |
| bool | ExistsValue (String^ predicate) |
| Executes the query on the server based on the predicate and returns whether any result exists. | |
| bool | ExistsValue (String^ predicate, TimeSpan timeout) |
| Executes the query on the server based on the predicate and returns whether any result exists. | |
| TValue | Get (TKey key) |
| Returns the value for the given key, passing the callback argument to any cache loaders or that are invoked in the operation. | |
| TValue | Get (TKey key, Object^ callbackArg) |
| Returns the value for the given key, passing the callback argument to any cache loaders or that are invoked in the operation. | |
| void | GetAll (System::Collections::Generic::ICollection< TKey >^ keys, System::Collections::Generic::IDictionary< TKey, TValue >^ values, System::Collections::Generic::IDictionary< TKey, System::Exception^>^ exceptions) |
| Gets values for collection of keys from the local cache or server. | |
| void | GetAll (System::Collections::Generic::ICollection< TKey >^ keys, System::Collections::Generic::IDictionary< TKey, TValue >^ values, System::Collections::Generic::IDictionary< TKey, System::Exception^>^ exceptions, bool addToLocalCache) |
| Gets values for collection of keys from the local cache or server. | |
| void | GetAll (System::Collections::Generic::ICollection< TKey >^ keys, System::Collections::Generic::IDictionary< TKey, TValue >^ values, System::Collections::Generic::IDictionary< TKey, System::Exception^>^ exceptions, bool addToLocalCache, Object^ callbackArg) |
| Gets values for collection of keys from the local cache or server. | |
| System::Collections::Generic::ICollection< Client::RegionEntry< TKey, TValue >^> ^ | GetEntries (bool recursive) |
| Gets the entries in this region. | |
| Client::RegionEntry< TKey, TValue > ^ | GetEntry (TKey key) |
| Return the meta-object RegionEntry for the given key. | |
| virtual System::Collections::Generic::IEnumerator< KeyValuePair< TKey, TValue > > ^ | GetEnumerator () |
| Returns an enumerator that iterates through the collection of the region entries. | |
| virtual System::Collections::IEnumerator ^ | GetEnumeratorOld () |
| Returns an enumerator that iterates through the collection of the region entries. | |
| IRegion< TKey, TValue > ^ | GetLocalView () |
| Reteuns an instance of a Region<TKey, TValue> class that executes within a local scope of a process. | |
| IRegion< TKey, TValue > ^ | GetSubRegion (String^ path) |
| Returns the subregion identified by the path, null if no such subregion. | |
| ISubscriptionService< TKey > ^ | GetSubscriptionService () |
| Reteuns an instance of a Region<TKey, TValue> class that implements ISubscriptionService interface This method is applicable only on distributed region & not on local region. | |
| void | Invalidate (TKey key) |
| Invalidates the entry with the specified key, passing the callback argument to any cache listeners that are invoked in the operation. | |
| void | Invalidate (TKey key, Object^ callbackArg) |
| Invalidates the entry with the specified key, passing the callback argument to any cache listeners that are invoked in the operation. | |
| void | InvalidateRegion () |
| Invalidates this region. | |
| void | InvalidateRegion (Object^ callbackArg) |
| Invalidates this region. | |
| void | Put (TKey key, TValue value) |
| Puts a new value into an entry in this region with the specified key. | |
| void | Put (TKey key, TValue value, Object^ callbackArg) |
| Puts a new value into an entry in this region with the specified key, passing the callback argument to any cache writers and cache listeners that are invoked in the operation. | |
| void | PutAll (IDictionary< TKey, TValue >^ map) |
| Puts a (IDictionary) generic collection of key/value pairs in this region. | |
| void | PutAll (IDictionary< TKey, TValue >^ map, TimeSpan timeout) |
| Puts a (IDictionary) generic collection of key/value pairs in this region. | |
| void | PutAll (IDictionary< TKey, TValue >^ map, TimeSpan timeout, Object^ callbackArg) |
| Puts a (IDictionary) generic collection of key/value pairs in this region. | |
| template<class TResult > | |
| ISelectResults< TResult > ^ | Query (String^ predicate) |
| Executes the query on the server based on the predicate. | |
| template<class TResult > | |
| ISelectResults< TResult > ^ | Query (String^ predicate, TimeSpan timeout) |
| Executes the query on the server based on the predicate. | |
| void | RemoveAll (System::Collections::Generic::ICollection< TKey >^ keys) |
| Removes all of the entries for the specified keys from this region. | |
| void | RemoveAll (System::Collections::Generic::ICollection< TKey >^ keys, Object^ callbackArg) |
| Removes all of the entries for the specified keys from this region. | |
| Object ^ | SelectValue (String^ predicate) |
| Executes the query on the server based on the predicate and returns a single result value. | |
| Object ^ | SelectValue (String^ predicate, TimeSpan timeout) |
| Executes the query on the server based on the predicate and returns a single result value. | |
| System::Collections::Generic::ICollection< IRegion< TKey, TValue >^> ^ | SubRegions (bool recursive) |
| Returns the subregions of this region. | |
Properties | |
| RegionAttributes< TKey, TValue >^ | Attributes [get] |
| Returns the attributes for this region, which can be used to create a new region with Cache.CreateRegion. | |
| AttributesMutator< TKey, TValue >^ | AttributesMutator [get] |
| Return a mutator object for changing a subset of the region attributes. | |
| virtual TValue | default [TKey] [get, set] |
| Gets or sets the element with the specified key. | |
| String^ | FullPath [get] |
| Gets the region's full path, which can be used to get this region object with Cache.GetRegion. | |
| bool | IsDestroyed [get] |
| True if this region has been destroyed. | |
| virtual bool | IsReadOnly [get] |
| This property throws NotImplementedException when called by both local and distributed region instances. | |
| virtual System::Collections::Generic::ICollection< TKey >^ | Keys [get] |
| Gets an ICollection containing the keys of the IDictionary Returns all the keys for this region. | |
| String^ | Name [get] |
| Gets the region name. | |
| IRegion< TKey, TValue >^ | ParentRegion [get] |
| Gets the parent region. | |
| Apache::Geode::Client::IRegionService^ | RegionService [get] |
| Gets the RegionService for this region. | |
| CacheStatistics^ | Statistics [get] |
| Returns the statistics for this region. | |
| virtual System::Collections::Generic::ICollection< TValue >^ | Values [get] |
| Gets an ICollection containing the values in the IDictionary. | |
Detailed Description
class Apache::Geode::Client::IRegion< TKey, TValue >
Encapsulates a concrete region of cached data.
Implements generic IDictionary<TKey, TValue> interface class.
This class manages subregions and cached data. Each region can contain multiple subregions and entries for data. Regions provide a hierachical name space within the cache. Also, a region can be used to group cached objects for management purposes.
Entries managed by the region are key-value pairs. A set of region attributes is associated with the region when it is created.
The IRegion interface basically contains two set of APIs: Region management APIs and (potentially) distributed operations on entries. Non-distributed operations on entries are provided by RegionEntry.
Each Cache defines regions called the root regions. User applications can use the root regions to create subregions for isolated name spaces and object grouping.
A region's name can be any string, except that it must not contain the region name separator, a forward slash (/).
Regions can be referenced by a relative path name from any region higher in the hierarchy in IRegion.GetSubRegion. You can get the relative path from the root region with IRegion.FullPath. The name separator is used to concatenate all the region names together from the root, starting with the root's subregions.
Member Function Documentation
◆ ContainsValueForKey()
| bool Apache::Geode::Client::IRegion< TKey, TValue >::ContainsValueForKey | ( | TKey | key | ) |
True if the region contains a value for the given key.
This only searches in the local cache.
<remark> For both local & distributed region instances this always searches only in local cache. </remark>
- Parameters
-
key key to search for
- Returns
- true if value is not null
◆ CreateSubRegion()
| IRegion< TKey, TValue > ^ Apache::Geode::Client::IRegion< TKey, TValue >::CreateSubRegion | ( | String^ | subRegionName, |
| RegionAttributes< TKey, TValue >^ | attributes | ||
| ) |
Creates a subregion with the given name and attributes.
- Parameters
-
subRegionName new subregion name attributes subregion attributes
- Returns
- new subregion
- See also
- CreateServerSubRegion
◆ DestroyRegion() [1/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::DestroyRegion | ( | ) |
Destroys the whole distributed region and provides a user-defined parameter object to any ICacheWriter invoked in the process.
Destroy cascades to all entries and subregions. After the destroy, this region object can not be used any more. Any attempt to use this region object will get a RegionDestroyedException The region destroy not only destroys the local region but also destroys the server region. For local region instance - destroys the whole local region only For distributed region instance - destroys the whole local region and this operation is also propogated to the Geode cache server to which it is connected.
Does not update any CacheStatistics.
- Exceptions
-
CacheWriterException if a CacheWriter aborts the operation; if this occurs some subregions may have already been successfully destroyed. CacheListenerException if CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out
- See also
- InvalidateRegion
◆ DestroyRegion() [2/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::DestroyRegion | ( | Object^ | callbackArg | ) |
Destroys the whole distributed region and provides a user-defined parameter object to any ICacheWriter invoked in the process.
Destroy cascades to all entries and subregions. After the destroy, this region object can not be used any more. Any attempt to use this region object will get a RegionDestroyedException The region destroy not only destroys the local region but also destroys the server region. For local region instance - destroys the whole local region only For distributed region instance - destroys the whole local region and this operation is also propogated to the Geode cache server to which it is connected.
Does not update any CacheStatistics.
- Parameters
-
callbackArg a user-defined parameter to pass to callback events triggered by this call
- Exceptions
-
CacheWriterException if a CacheWriter aborts the operation; if this occurs some subregions may have already been successfully destroyed. CacheListenerException if CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out
- See also
- InvalidateRegion
◆ ExistsValue() [1/2]
| bool Apache::Geode::Client::IRegion< TKey, TValue >::ExistsValue | ( | String^ | predicate | ) |
Executes the query on the server based on the predicate and returns whether any result exists.
Valid only for a Native Client region. This method is applicable only on distributed region & not on local region.
- Parameters
-
predicate The query predicate (just the WHERE clause) or the entire query to execute
- Exceptions
-
IllegalArgumentException If the predicate is empty. IllegalStateException If some error occurred. CacheServerException If an exception is received from the Java cache server. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. QueryException If some query error occurred at the server. TimeoutException if the operation timed out CacheClosedException if the cache has been closed NotSupportedException if it is called by local region instance Region.GetLocalView
- Returns
- true if the result size is non-zero, false otherwise.
◆ ExistsValue() [2/2]
| bool Apache::Geode::Client::IRegion< TKey, TValue >::ExistsValue | ( | String^ | predicate, |
| TimeSpan | timeout | ||
| ) |
Executes the query on the server based on the predicate and returns whether any result exists.
Valid only for a Native Client region. This method is applicable only on distributed region & not on local region.
- Parameters
-
predicate The query predicate (just the WHERE clause) or the entire query to execute timeout The time (in seconds) to wait for the query response
- Exceptions
-
IllegalArgumentException If the predicate is empty. IllegalStateException If some error occurred. CacheServerException If an exception is received from the Java cache server. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. QueryException If some query error occurred at the server. TimeoutException if the operation timed out CacheClosedException if the cache has been closed NotSupportedException if it is called by local region instance Region.GetLocalView
- Returns
- true if the result size is non-zero, false otherwise.
◆ Get() [1/2]
| TValue Apache::Geode::Client::IRegion< TKey, TValue >::Get | ( | TKey | key | ) |
Returns the value for the given key, passing the callback argument to any cache loaders or that are invoked in the operation.
For local region instance - returns the value with the specified key from the local cache only. For distributed region instance - 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 CacheStatistics.LastAccessedTime CacheStatistics.HitCount, CacheStatistics.MissCount, and CacheStatistics.LastModifiedTime (if a new value is loaded) for this region and the entry.
- Parameters
-
key key whose associated value is to be returned – the key object must implement the Equals and GetHashCode methods.
- Returns
- value, or null if the value is not found and can't be loaded
- Exceptions
-
IllegalArgumentException if key is null CacheLoaderException if CacheLoader throws an exception CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. TimeoutException if the operation timed out RegionDestroyedException if this region has been destroyed
- See also
- Put
◆ Get() [2/2]
| TValue Apache::Geode::Client::IRegion< TKey, TValue >::Get | ( | TKey | key, |
| Object^ | callbackArg | ||
| ) |
Returns the value for the given key, passing the callback argument to any cache loaders or that are invoked in the operation.
For local region instance - returns the value with the specified key from the local cache only. For distributed region instance - 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 CacheStatistics.LastAccessedTime CacheStatistics.HitCount, CacheStatistics.MissCount, and CacheStatistics.LastModifiedTime (if a new value is loaded) for this region and the entry.
- Parameters
-
key key whose associated value is to be returned – the key object must implement the Equals and GetHashCode methods. callbackArg An argument passed into the CacheLoader if loader is used. Has to be Serializable (i.e. implement ISerializable); can be null.
- Returns
- value, or null if the value is not found and can't be loaded
- Exceptions
-
IllegalArgumentException if key is null CacheLoaderException if CacheLoader throws an exception CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. TimeoutException if the operation timed out RegionDestroyedException if this region has been destroyed
- See also
- Put
◆ GetAll() [1/3]
| void Apache::Geode::Client::IRegion< TKey, TValue >::GetAll | ( | System::Collections::Generic::ICollection< TKey >^ | keys, |
| System::Collections::Generic::IDictionary< TKey, TValue >^ | values, | ||
| System::Collections::Generic::IDictionary< TKey, System::Exception^>^ | exceptions | ||
| ) |
Gets values for collection of keys from the local cache or server.
If value for a key is not present locally then it is requested from the java server. The value returned is not copied, so multi-threaded applications should not modify the value directly, but should use the update methods. For local region instance - this method is not applicable. Updates the CacheStatistics.LastAccessedTime and CacheStatistics.HitCount and CacheStatistics.MissCount for this region and the entry.
- Parameters
-
keys the collection of keys values output parameter that provides the map of keys to respective values; when this is NULL then an IllegalArgumentExceptionis thrown.exceptions output parameter that provides the map of keys to any exceptions while obtaining the key; ignored if this is NULL
- Exceptions
-
IllegalArgumentException If the collection of keys is null or empty, or valuesargument is null.CacheServerException If an exception is received from the Java cache server while processing the request. NotConnectedException if region is not connected to the cache because the client cannot establish usable connections to any of the given servers For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. RegionDestroyedException If region destroy is pending. TimeoutException if operation timed out. UnknownException For other exceptions. NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Get
◆ GetAll() [2/3]
| void Apache::Geode::Client::IRegion< TKey, TValue >::GetAll | ( | System::Collections::Generic::ICollection< TKey >^ | keys, |
| System::Collections::Generic::IDictionary< TKey, TValue >^ | values, | ||
| System::Collections::Generic::IDictionary< TKey, System::Exception^>^ | exceptions, | ||
| bool | addToLocalCache | ||
| ) |
Gets values for collection of keys from the local cache or server.
If value for a key is not present locally then it is requested from the java server. The value returned is not copied, so multi-threaded applications should not modify the value directly, but should use the update methods. For local region instance - this method is not applicable. Updates the CacheStatistics.LastAccessedTime and CacheStatistics.HitCount and CacheStatistics.MissCount for this region and the entry.
- Parameters
-
keys the collection of keys values output parameter that provides the map of keys to respective values; ignored if NULL; when this is NULL then at least the addToLocalCacheparameter should be true and caching should be enabled for the region to get values into the region otherwise anIllegalArgumentExceptionis thrown.exceptions output parameter that provides the map of keys to any exceptions while obtaining the key; ignored if this is NULL addToLocalCache true if the obtained values have also to be added to the local cache
- Exceptions
-
IllegalArgumentException If the collection of keys is null or empty. Other invalid case is when the valuesparameter is NULL, and eitheraddToLocalCacheis false or caching is disabled for this region.CacheServerException If an exception is received from the Java cache server while processing the request. NotConnectedException if region is not connected to the cache because the client cannot establish usable connections to any of the given servers For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. RegionDestroyedException If region destroy is pending. TimeoutException if operation timed out. UnknownException For other exceptions. NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Get
◆ GetAll() [3/3]
| void Apache::Geode::Client::IRegion< TKey, TValue >::GetAll | ( | System::Collections::Generic::ICollection< TKey >^ | keys, |
| System::Collections::Generic::IDictionary< TKey, TValue >^ | values, | ||
| System::Collections::Generic::IDictionary< TKey, System::Exception^>^ | exceptions, | ||
| bool | addToLocalCache, | ||
| Object^ | callbackArg | ||
| ) |
Gets values for collection of keys from the local cache or server.
If value for a key is not present locally then it is requested from the java server. The value returned is not copied, so multi-threaded applications should not modify the value directly, but should use the update methods. For local region instance - this method is not applicable. Updates the CacheStatistics.LastAccessedTime and CacheStatistics.HitCount and CacheStatistics.MissCount for this region and the entry.
- Parameters
-
keys the collection of keys values output parameter that provides the map of keys to respective values; ignored if NULL; when this is NULL then at least the addToLocalCacheparameter should be true and caching should be enabled for the region to get values into the region otherwise anIllegalArgumentExceptionis thrown.exceptions output parameter that provides the map of keys to any exceptions while obtaining the key; ignored if this is NULL addToLocalCache true if the obtained values have also to be added to the local cache callbackArg a user-defined parameter to pass to callback events triggered by this method
- Exceptions
-
IllegalArgumentException If the collection of keys is null or empty. Other invalid case is when the valuesparameter is NULL, and eitheraddToLocalCacheis false or caching is disabled for this region.CacheServerException If an exception is received from the Java cache server while processing the request. NotConnectedException if region is not connected to the cache because the client cannot establish usable connections to any of the given servers For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. RegionDestroyedException If region destroy is pending. TimeoutException if operation timed out. UnknownException For other exceptions. NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Get
◆ GetEntries()
| System::Collections::Generic::ICollection< Client::RegionEntry< TKey, TValue >^> ^ Apache::Geode::Client::IRegion< TKey, TValue >::GetEntries | ( | bool | recursive | ) |
Gets the entries in this region.
For both local & distributed region instances, this operation happens in local cache only.
- Parameters
-
recursive if true, also return all nested subregion entries
- Returns
- collection of entries
◆ GetEntry()
| Client::RegionEntry< TKey, TValue > ^ Apache::Geode::Client::IRegion< TKey, TValue >::GetEntry | ( | TKey | key | ) |
Return the meta-object RegionEntry for the given key.
For both local & distributed region instances, this operation happens in local cache only.
- Parameters
-
key key to use
- Returns
- region entry object
- Exceptions
-
IllegalArgumentException key is null RegionDestroyedException region has been destroyed
◆ GetEnumerator()
|
virtual |
Returns an enumerator that iterates through the collection of the region entries.
This operation is performed entirely in local cache.
The foreach statement of the C# language (for each in C++)hides the complexity of the enumerators. Therefore, using foreach is recommended, instead of directly manipulating the enumerator. Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection. Initially, the enumerator is positioned before the first element in the collection. At this position, Current is undefined. Therefore, you must call MoveNext to advance the enumerator to the first element of the collection before reading the value of Current. Current returns the same object until MoveNext is called. MoveNext sets Current to the next element. If MoveNext passes the end of the collection, the enumerator is positioned after the last element in the collection and MoveNext returns false. When the enumerator is at this position, subsequent calls to MoveNext also return false. If the last call to MoveNext returned false, Current is undefined. You cannot set Current to the first element of the collection again; you must create a new enumerator instance instead. The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization. Default implementations of collections in the System.Collections.Generic namespace are not synchronized. For both local & distributed region instances, this operation is restricted to local cache only.
- Exceptions
-
InvalidOperationException if enumerator is before or after the collection and Current method is called on it.
- Returns
- Type: System.Collections.Generic.IEnumerator<T>. A IEnumerator<T> that can be used to iterate through the collection.
◆ GetEnumeratorOld()
|
inlinevirtual |
Returns an enumerator that iterates through the collection of the region entries.
This operation is performed entirely in local cache.
The foreach statement of the C# language (for each in C++)hides the complexity of the enumerators. Therefore, using foreach is recommended, instead of directly manipulating the enumerator. Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection. Initially, the enumerator is positioned before the first element in the collection. At this position, Current is undefined. Therefore, you must call MoveNext to advance the enumerator to the first element of the collection before reading the value of Current. Current returns the same object until MoveNext is called. MoveNext sets Current to the next element. If MoveNext passes the end of the collection, the enumerator is positioned after the last element in the collection and MoveNext returns false. When the enumerator is at this position, subsequent calls to MoveNext also return false. If the last call to MoveNext returned false, Current is undefined. You cannot set Current to the first element of the collection again; you must create a new enumerator instance instead. The enumerator does not have exclusive access to the collection; therefore, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization. For both local & distributed region instances, this operation is restricted to local cache only.
- Exceptions
-
InvalidOperationException if enumerator is before or after the collection and Current method is called on it.
- Returns
- Type: System.Collections.IEnumerator. An IEnumerator object that can be used to iterate through the collection.
◆ GetLocalView()
| IRegion< TKey, TValue > ^ Apache::Geode::Client::IRegion< TKey, TValue >::GetLocalView | ( | ) |
Reteuns an instance of a Region<TKey, TValue> class that executes within a local scope of a process.
This method is applicable only on distributed region & not on local region.
- Exceptions
-
NotSupportedException if it is called by local region instance Region.GetLocalView
◆ GetSubRegion()
| IRegion< TKey, TValue > ^ Apache::Geode::Client::IRegion< TKey, TValue >::GetSubRegion | ( | String^ | path | ) |
Returns the subregion identified by the path, null if no such subregion.
- Parameters
-
path path
- Returns
- subregion, or null if none
- See also
- FullPath, SubRegions, ParentRegion
◆ GetSubscriptionService()
| ISubscriptionService< TKey > ^ Apache::Geode::Client::IRegion< TKey, TValue >::GetSubscriptionService | ( | ) |
Reteuns an instance of a Region<TKey, TValue> class that implements ISubscriptionService interface This method is applicable only on distributed region & not on local region.
- Exceptions
-
NotSupportedException if it is called by local region instance Region.GetLocalView
◆ Invalidate() [1/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::Invalidate | ( | TKey | key | ) |
Invalidates the entry with the specified key, passing the callback argument to any cache listeners that are invoked in the operation.
Invalidate only removes the value from the entry – the key is kept intact. To completely remove the entry, call Destroy.
For both local & distributed region instaces, invalidate is not propogated to the Geode cache server to which it is connected.
Does not update any CacheStatistics.
- Parameters
-
key key of the value to be invalidated
- Exceptions
-
IllegalArgumentException if key is null EntryNotFoundException if this entry does not exist in this region locally RegionDestroyedException if the region is destroyed
- See also
- Destroy, ICacheListener.AfterInvalidate
◆ Invalidate() [2/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::Invalidate | ( | TKey | key, |
| Object^ | callbackArg | ||
| ) |
Invalidates the entry with the specified key, passing the callback argument to any cache listeners that are invoked in the operation.
Invalidate only removes the value from the entry – the key is kept intact. To completely remove the entry, call Destroy.
For both local & distributed region instaces, invalidate is not propogated to the Geode cache server to which it is connected.
Does not update any CacheStatistics.
- Parameters
-
key key of the value to be invalidated callbackArg a user-defined parameter to pass to callback events triggered by this method
- Exceptions
-
IllegalArgumentException if key is null EntryNotFoundException if this entry does not exist in this region locally RegionDestroyedException if the region is destroyed
- See also
- Destroy, ICacheListener.AfterInvalidate
◆ InvalidateRegion() [1/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::InvalidateRegion | ( | ) |
Invalidates this region.
The invalidation will cascade to all the subregions and cached entries. The region and the entries in it will still exist. For local region instance - invalidates this region without distributing to other caches. For distributed region instance - Invalidates this region and this operation is propogated to the Geode cache server to which it is connected.
To remove all the entries and the region, use DestroyRegion.
Does not update any CacheStatistics.
- Exceptions
-
CacheListenerException if CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. RegionDestroyedException if this region has been destroyed
◆ InvalidateRegion() [2/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::InvalidateRegion | ( | Object^ | callbackArg | ) |
Invalidates this region.
The invalidation will cascade to all the subregions and cached entries. The region and the entries in it will still exist. For local region instance - invalidates this region without distributing to other caches. For distributed region instance - Invalidates this region and this operation is propogated to the Geode cache server to which it is connected.
To remove all the entries and the region, use DestroyRegion.
Does not update any CacheStatistics.
- Parameters
-
callbackArg user-defined parameter to pass to callback events triggered by this method
- Exceptions
-
NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. RegionDestroyedException if this region has been destroyed CacheListenerException if CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated
◆ Put() [1/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::Put | ( | TKey | key, |
| TValue | value | ||
| ) |
Puts a new value into an entry in this region with the specified key.
If there is already an entry associated with the specified key in this region, the entry's previous value is overwritten. The new put value is propogated to the java server to which it is connected. Put is intended for very simple caching situations. In general it is better to create a ICacheLoader object and allow the cache to manage the creation and loading of objects. For local region instance - Puts a new value into an entry in this region in the local cache only. For distributed region instance - Puts a new value into an entry in this region and this operation is propogated to the Geode cache server to which it is connected.
Updates the CacheStatistics.LastAccessedTime and CacheStatistics.LastModifiedTime for this region and the entry.
If remote server put fails throwing back a CacheServerException or security exception, then local put is tried to rollback. However, if the entry has overflowed/evicted/expired then the rollback is aborted since it may be due to a more recent notification or update by another thread.
- Parameters
-
key a key object associated with the value to be put into this region value the value to be put into this region
- Exceptions
-
IllegalArgumentException if key is null CacheWriterException if CacheWriter aborts the operation CacheListenerException if CacheListener throws an exception RegionDestroyedException if region has been destroyed CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out OutOfMemoryException if there is not enough memory for the value
- See also
- Get, Add
◆ Put() [2/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::Put | ( | TKey | key, |
| TValue | value, | ||
| Object^ | callbackArg | ||
| ) |
Puts a new value into an entry in this region with the specified key, passing the callback argument to any cache writers and cache listeners that are invoked in the operation.
If there is already an entry associated with the specified key in this region, the entry's previous value is overwritten. The new put value is propogated to the java server to which it is connected. Put is intended for very simple caching situations. In general it is better to create a ICacheLoader object and allow the cache to manage the creation and loading of objects. For local region instance - Puts a new value into an entry in this region in the local cache only. For distributed region instance - Puts a new value into an entry in this region and this operation is propogated to the Geode cache server to which it is connected.
Updates the CacheStatistics.LastAccessedTime and CacheStatistics.LastModifiedTime for this region and the entry.
If remote server put fails throwing back a CacheServerException or security exception, then local put is tried to rollback. However, if the entry has overflowed/evicted/expired then the rollback is aborted since it may be due to a more recent notification or update by another thread.
- Parameters
-
key a key object associated with the value to be put into this region. value the value to be put into this region callbackArg argument that is passed to the callback functions
- Exceptions
-
IllegalArgumentException if key is null CacheWriterException if CacheWriter aborts the operation CacheListenerException if CacheListener throws an exception RegionDestroyedException if region has been destroyed CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out OutOfMemoryException if there is not enough memory for the value
- See also
- Get, Add
◆ PutAll() [1/3]
| void Apache::Geode::Client::IRegion< TKey, TValue >::PutAll | ( | IDictionary< TKey, TValue >^ | map | ) |
Puts a (IDictionary) generic collection of key/value pairs in this region.
If there is already an entry associated with any key in the map in this region, the entry's previous value is overwritten. The new values are propogated to the java server to which it is connected. PutAll is intended for speed up large amount of put operation into the same region. For local region instance - this method is not applicable.
- Parameters
-
map A map contains entries, i.e. (key, value) pairs. It is generic collection of key/value pairs. Value should not be null in any of the entries.
- Exceptions
-
NullPointerException if any value in the map is null RegionDestroyedException if region has been destroyed CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out OutOfMemoryException if there is not enough memory for the value NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Put
◆ PutAll() [2/3]
| void Apache::Geode::Client::IRegion< TKey, TValue >::PutAll | ( | IDictionary< TKey, TValue >^ | map, |
| TimeSpan | timeout | ||
| ) |
Puts a (IDictionary) generic collection of key/value pairs in this region.
If there is already an entry associated with any key in the map in this region, the entry's previous value is overwritten. The new values are propogated to the java server to which it is connected. PutAll is intended for speed up large amount of put operation into the same region. For local region instance - this method is not applicable.
- Parameters
-
map A map contains entries, i.e. (key, value) pairs. It is generic collection of key/value pairs. Value should not be null in any of the entries. timeout The time (in seconds) to wait for the PutAll response. It should be less than or equal to 2^31/1000 i.e. 2147483. Optional.
- Exceptions
-
IllegalArgumentException If timeout is more than 2^31/1000 i.e. 2147483. NullPointerException if any value in the map is null RegionDestroyedException if region has been destroyed CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out OutOfMemoryException if there is not enough memory for the value NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Put
◆ PutAll() [3/3]
| void Apache::Geode::Client::IRegion< TKey, TValue >::PutAll | ( | IDictionary< TKey, TValue >^ | map, |
| TimeSpan | timeout, | ||
| Object^ | callbackArg | ||
| ) |
Puts a (IDictionary) generic collection of key/value pairs in this region.
If there is already an entry associated with any key in the map in this region, the entry's previous value is overwritten. The new values are propogated to the java server to which it is connected. PutAll is intended for speed up large amount of put operation into the same region. For local region instance - this method is not applicable.
- Parameters
-
map A map contains entries, i.e. (key, value) pairs. It is generic collection of key/value pairs. Value should not be null in any of the entries. timeout The time (in seconds) to wait for the PutAll response. It should be less than or equal to 2^31/1000 i.e. 2147483. Optional. callbackArg a user-defined parameter to pass to callback events triggered by this method
- Exceptions
-
IllegalArgumentException If timeout is more than 2^31/1000 i.e. 2147483. NullPointerException if any value in the map is null RegionDestroyedException if region has been destroyed CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out OutOfMemoryException if there is not enough memory for the value NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Put
◆ Query() [1/2]
| ISelectResults< TResult > ^ Apache::Geode::Client::IRegion< TKey, TValue >::Query | ( | String^ | predicate | ) |
Executes the query on the server based on the predicate.
Valid only for a Native Client region. This method is applicable only on distributed region & not on local region.
- Parameters
-
predicate The query predicate (just the WHERE clause) or the entire query to execute
- Exceptions
-
IllegalArgumentException If the predicate is empty. IllegalStateException If some error occurred. CacheServerException If an exception is received from the Java cache server. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. QueryException If some query error occurred at the server. TimeoutException if the operation timed out CacheClosedException if the cache has been closed NotSupportedException if it is called by local region instance Region.GetLocalView
◆ Query() [2/2]
| ISelectResults< TResult > ^ Apache::Geode::Client::IRegion< TKey, TValue >::Query | ( | String^ | predicate, |
| TimeSpan | timeout | ||
| ) |
Executes the query on the server based on the predicate.
Valid only for a Native Client region. This method is applicable only on distributed region & not on local region.
- Parameters
-
predicate The query predicate (just the WHERE clause) or the entire query to execute timeout The time (in seconds) to wait for the query response, optional
- Exceptions
-
IllegalArgumentException If the predicate is empty. IllegalStateException If some error occurred. CacheServerException If an exception is received from the Java cache server. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. QueryException If some query error occurred at the server. TimeoutException if the operation timed out CacheClosedException if the cache has been closed NotSupportedException if it is called by local region instance Region.GetLocalView
◆ RemoveAll() [1/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::RemoveAll | ( | System::Collections::Generic::ICollection< TKey >^ | keys | ) |
Removes all of the entries for the specified keys from this region.
The effect of this call is equivalent to that of calling destroy(Object) on this region once for each key in the specified collection. If an entry does not exist that key is skipped; EntryNotFoundException is not thrown. For local region instance - this method is not applicable. Updates the CacheStatistics.LastAccessedTime and CacheStatistics.HitCount and CacheStatistics.MissCount for this region and the entry.
- Parameters
-
keys the collection of keys
- Exceptions
-
IllegalArgumentException If the collection of keys is null or empty. CacheServerException If an exception is received from the Java cache server while processing the request. NotConnectedException if region is not connected to the cache because the client cannot establish usable connections to any of the given servers For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. RegionDestroyedException If region destroy is pending. TimeoutException if operation timed out. UnknownException For other exceptions. NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Get
◆ RemoveAll() [2/2]
| void Apache::Geode::Client::IRegion< TKey, TValue >::RemoveAll | ( | System::Collections::Generic::ICollection< TKey >^ | keys, |
| Object^ | callbackArg | ||
| ) |
Removes all of the entries for the specified keys from this region.
The effect of this call is equivalent to that of calling remove(Object) on this region once for each key in the specified collection. If an entry does not exist that key is skipped; EntryNotFoundException is not thrown. For local region instance - this method is not applicable. Updates the CacheStatistics.LastAccessedTime and CacheStatistics.HitCount and CacheStatistics.MissCount for this region and the entry.
- Parameters
-
keys the collection of keys callbackArg an argument that is passed to the callback functions. Optional.
- Exceptions
-
IllegalArgumentException If the collection of keys is null or empty. CacheServerException If an exception is received from the Java cache server while processing the request. NotConnectedException if region is not connected to the cache because the client cannot establish usable connections to any of the given servers For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. RegionDestroyedException If region destroy is pending. TimeoutException if operation timed out. UnknownException For other exceptions. NotSupportedException if it is called by local region instance Region.GetLocalView
- See also
- Remove
◆ SelectValue() [1/2]
| Object ^ Apache::Geode::Client::IRegion< TKey, TValue >::SelectValue | ( | String^ | predicate | ) |
Executes the query on the server based on the predicate and returns a single result value.
Valid only for a Native Client region. This method is applicable only on distributed region & not on local region.
- Parameters
-
predicate The query predicate (just the WHERE clause) or the entire query to execute
- Exceptions
-
IllegalArgumentException If the predicate is empty. IllegalStateException If some error occurred. CacheServerException If an exception is received from the Java cache server. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. QueryException If some query error occurred at the server, or more than one result items are available. TimeoutException if the operation timed out CacheClosedException if the cache has been closed NotSupportedException if it is called by local region instance Region.GetLocalView
◆ SelectValue() [2/2]
| Object ^ Apache::Geode::Client::IRegion< TKey, TValue >::SelectValue | ( | String^ | predicate, |
| TimeSpan | timeout | ||
| ) |
Executes the query on the server based on the predicate and returns a single result value.
Valid only for a Native Client region. This method is applicable only on distributed region & not on local region.
- Parameters
-
predicate The query predicate (just the WHERE clause) or the entire query to execute timeout The time (in seconds) to wait for the query response
- Exceptions
-
IllegalArgumentException If the predicate is empty. IllegalStateException If some error occurred. CacheServerException If an exception is received from the Java cache server. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. QueryException If some query error occurred at the server, or more than one result items are available. TimeoutException if the operation timed out CacheClosedException if the cache has been closed NotSupportedException if it is called by local region instance Region.GetLocalView
◆ SubRegions()
| System::Collections::Generic::ICollection< IRegion< TKey, TValue >^> ^ Apache::Geode::Client::IRegion< TKey, TValue >::SubRegions | ( | bool | recursive | ) |
Returns the subregions of this region.
- Parameters
-
recursive if true, also return all nested subregions
- Returns
- collection of regions
- Exceptions
-
RegionDestroyedException this region has already been destroyed
Property Documentation
◆ Attributes
|
get |
Returns the attributes for this region, which can be used to create a new region with Cache.CreateRegion.
- Returns
- region's attributes
◆ AttributesMutator
|
get |
Return a mutator object for changing a subset of the region attributes.
- Returns
- attribute mutator
- Exceptions
-
RegionDestroyedException if the region has been destroyed
◆ default
|
getset |
Gets or sets the element with the specified key.
This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[key]. You can also use the Item property to add new elements by setting the value of a key that does not exist in the dictionary; for example, myCollection["myNonexistentKey"] = myValue However, if the specified key already exists in the dictionary, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements. This property is applicable to local as well as distributed region. For local region instance - Puts/Gets a new value into an entry in this region in the local cache only. For distributed region instance - Puts/Gets a new value into an entry in this region and this operation is propogated to the Geode cache server to which it is connected.
- Parameters
-
key The key of the element to get or set. Property Value The element with the specified key.
- Exceptions
-
IllegalArgumentException if key is null KeyNotFoundException If given key was not present in the region and if region is not in secure mode, or if Pool attached with Region is not in multiusersecure mode. EntryNotFoundException if given key's value is null. CacheWriterException if CacheWriter aborts the operation CacheListenerException if CacheListener throws an exception RegionDestroyedException if region has been destroyed CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. TimeoutException if the operation timed out OutOfMemoryException if there is not enough memory for the value CacheLoaderException if CacheLoader throws an exception 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.
◆ FullPath
|
get |
Gets the region's full path, which can be used to get this region object with Cache.GetRegion.
- Returns
- region's pathname
◆ IsDestroyed
|
get |
True if this region has been destroyed.
- Returns
- true if destroyed
◆ IsReadOnly
|
get |
This property throws NotImplementedException when called by both local and distributed region instances.
◆ Keys
|
get |
Gets an ICollection containing the keys of the IDictionary Returns all the keys for this region.
This includes keys for which the entry is invalid. For local region instance - gets collection of keys from local cache only. For distributed region instance - gets collection of keys from the Geode cache server.
- Returns
- collection of keys
<remark> The order of the keys in the returned ICollection is unspecified, but it is guaranteed to be the same order as the corresponding values in the ICollection returned by the Values property. </remark>
- Exceptions
-
UnsupportedOperationException if the member type is not Clientor region is not a Native Client region.CacheServerException If an exception is received from the Java cache server. Only for Native Client regions. NotConnectedException if not connected to the Geode system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException. 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. TimeoutException if there is a timeout getting the keys
◆ Name
|
get |
Gets the region name.
- Returns
- region's name
◆ ParentRegion
|
get |
Gets the parent region.
- Returns
- region's parent, if any, or null if this is a root region
- Exceptions
-
RegionDestroyedException if the region has been destroyed
◆ RegionService
|
get |
Gets the RegionService for this region.
- Returns
- RegionService
◆ Statistics
|
get |
Returns the statistics for this region.
- Returns
- the
CacheStatisticsfor this region
- Exceptions
-
StatisticsDisabledException if statistics have been disabled for this region
◆ Values
|
get |
Gets an ICollection containing the values in the IDictionary.
Returns all values in the local process for this region. No value is included for entries that are invalidated. For both local & distributed region instances, this operation is always local only.
- Returns
- collection of values
<remark> The order of the values in the returned ICollection is unspecified, but it is guaranteed to be the same order as the corresponding keys in the ICollection returned by the Keys property. </remark>
Apache Geode C++ Cache .NET API Documentation