VMware Tanzu GemFire Native C++ Reference 10.2.7
apache::geode::client::Region Class Referenceabstract

This class manages subregions and cached data. More...

#include <Region.hpp>

Inherits std::enable_shared_from_this< Region >.

Public Member Functions

virtual void clear (const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Removes all entries from this region and provides a user-defined parameter object to any CacheWriter or CacheListener invoked in the process. More...
 
template<class KEYTYPE >
bool containsKey (const KEYTYPE &key) const
 Convenience method allowing key to be a const char* This operations checks for the key in the local cache . More...
 
virtual bool containsKey (const std::shared_ptr< CacheableKey > &keyPtr) const =0
 Only the client's cache is searched for the key. More...
 
virtual bool containsKeyOnServer (const std::shared_ptr< CacheableKey > &keyPtr) const =0
 The cache of the server, to which it is connected with, is searched for the key to see if the key is present. More...
 
template<class KEYTYPE >
bool containsValueForKey (const KEYTYPE &key) const
 Convenience method allowing key to be a const char* This operations checks for the value in the local cache . More...
 
virtual bool containsValueForKey (const std::shared_ptr< CacheableKey > &keyPtr) const =0
 This operations checks for the value in the local cache . More...
 
template<class KEYTYPE >
void create (const KEYTYPE &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
template<class KEYTYPE , class VALUETYPE >
void create (const KEYTYPE &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing both key and value to be a const char*. More...
 
virtual void create (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Creates a new entry in this region with the specified key and value, providing a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class VALUETYPE >
void create (const std::shared_ptr< CacheableKey > &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing value to be a const char*. More...
 
virtual std::shared_ptr< RegioncreateSubregion (const std::string &subregionName, RegionAttributes aRegionAttributes)=0
 Creates a subregion with the specified attributes. More...
 
template<class KEYTYPE >
void destroy (const KEYTYPE &key, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
virtual void destroy (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Destroys the entry with the specified key, and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
virtual void destroyRegion (const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Destroys the whole region and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
virtual bool existsValue (const std::string &predicate, std::chrono::milliseconds timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0
 Executes the query on the server based on the predicate and returns whether any result exists. More...
 
template<class KEYTYPE >
std::shared_ptr< Cacheableget (const KEYTYPE &key, const std::shared_ptr< Serializable > &callbackArg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
virtual std::shared_ptr< Cacheableget (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Returns the value associated with the specified key, passing the callback argument to any cache loaders that are invoked in the operation. More...
 
virtual HashMapOfCacheable getAll (const std::vector< std::shared_ptr< CacheableKey > > &keys, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Gets values for an array of keys from the local cache or server. More...
 
virtual const RegionAttributesgetAttributes () const =0
 Return the RegionAttributes for this region. More...
 
virtual std::shared_ptr< AttributesMutatorgetAttributesMutator () const =0
 Return the a mutator object for changing a subset of the region attributes. More...
 
template<class KEYTYPE >
std::shared_ptr< RegionEntrygetEntry (const KEYTYPE &key)
 Convenience method allowing key to be a const char*. More...
 
virtual std::shared_ptr< RegionEntrygetEntry (const std::shared_ptr< CacheableKey > &key)=0
 Return the meta-object RegionEntry for key. More...
 
virtual const std::string & getFullPath () const =0
 return the full path of the region as can be used to lookup the region from Cache::getRegion. More...
 
virtual std::vector< std::shared_ptr< CacheableKey > > getInterestList () const =0
 Returns the list of keys on which this client is interested and will be notified of changes. More...
 
virtual std::vector< std::shared_ptr< CacheableString > > getInterestListRegex () const =0
 Returns the list of regular expresssions on which this client is interested and will be notified of changes. More...
 
virtual const std::string & getName () const =0
 Public Methods. More...
 
virtual std::shared_ptr< RegiongetParentRegion () const =0
 Returns the parent region, or nullptr if a root region. More...
 
virtual RegionServicegetRegionService () const =0
 Returns the cache associated with this region. More...
 
virtual std::shared_ptr< RegiongetSubregion (const std::string &path)=0
 Returns the subregion identified by the path, nullptr if no such subregion. More...
 
template<class KEYTYPE >
void invalidate (const KEYTYPE &key, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
virtual void invalidate (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Invalidates the entry with the specified key, and provides a user-defined argument to the CacheListener. More...
 
virtual void invalidateRegion (const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Invalidates this region. More...
 
virtual std::vector< std::shared_ptr< CacheableKey > > keys ()=0
 Return all the keys in the local process for this region. More...
 
virtual void localClear (const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Removes all entries from this region and provides a user-defined parameter object to any CacheWriter or CacheListener invoked in the process. More...
 
template<class KEYTYPE >
void localCreate (const KEYTYPE &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
template<class KEYTYPE , class VALUETYPE >
void localCreate (const KEYTYPE &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing both key and value to be a const char*. More...
 
virtual void localCreate (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Creates a new entry in this region with the specified key and value in the local cache only, providing a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class VALUETYPE >
void localCreate (const std::shared_ptr< CacheableKey > &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing value to be a const char*. More...
 
template<class KEYTYPE >
void localDestroy (const KEYTYPE &key, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
virtual void localDestroy (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Destroys the entry with the specified key in the local cache only, and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
virtual void localDestroyRegion (const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Destroys the whole region and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class KEYTYPE >
void localInvalidate (const KEYTYPE &key, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
virtual void localInvalidate (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Invalidates the entry with the specified key in the local cache only, and provides a user-defined argument to the CacheListener. More...
 
virtual void localInvalidateRegion (const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Invalidates this region. More...
 
template<class KEYTYPE >
void localPut (const KEYTYPE &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
template<class KEYTYPE , class VALUETYPE >
void localPut (const KEYTYPE &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing both key and value to be a const char*. More...
 
virtual void localPut (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Places a new value into an entry in this region with the specified key in the local cache only, providing a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class VALUETYPE >
void localPut (const std::shared_ptr< CacheableKey > &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing value to be a const char*. More...
 
template<class KEYTYPE >
bool localRemove (const KEYTYPE &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
template<class KEYTYPE , class VALUETYPE >
bool localRemove (const KEYTYPE &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing both key and value to be a const char*. More...
 
virtual bool localRemove (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Removes the entry with the specified key and value in the local cache only, and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class VALUETYPE >
bool localRemove (const std::shared_ptr< CacheableKey > &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing value to be a const char*. More...
 
template<class KEYTYPE >
bool localRemoveEx (const KEYTYPE &key, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
virtual bool localRemoveEx (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Removes the entry with the specified key in the local cache only, and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class KEYTYPE >
void put (const KEYTYPE &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
template<class KEYTYPE , class VALUETYPE >
void put (const KEYTYPE &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing both key and value to be a const char*. More...
 
virtual void put (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Places a new value into an entry in this region with the specified key, providing a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class VALUETYPE >
void put (const std::shared_ptr< CacheableKey > &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing value to be a const char*. More...
 
virtual void putAll (const HashMapOfCacheable &map, std::chrono::milliseconds timeout=DEFAULT_RESPONSE_TIMEOUT, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Places a set of new values in this region with the specified keys given as a map of key/value pairs. More...
 
virtual std::shared_ptr< SelectResultsquery (const std::string &predicate, std::chrono::milliseconds timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0
 Executes the query on the server based on the predicate. More...
 
virtual void registerAllKeys (bool isDurable=false, bool getInitialValues=false, bool receiveValues=true)=0
 Registers to get updates for all keys from the server. More...
 
virtual void registerKeys (const std::vector< std::shared_ptr< CacheableKey > > &keys, bool isDurable=false, bool getInitialValues=false, bool receiveValues=true)=0
 Registers an array of keys for getting updates from the server. More...
 
virtual void registerRegex (const std::string &regex, bool isDurable=false, bool getInitialValues=false, bool receiveValues=true)=0
 Registers a regular expression to match with keys to get updates from the server. More...
 
template<class KEYTYPE >
bool remove (const KEYTYPE &key)
 Convenience method allowing both key and value to be a const char*. More...
 
template<class KEYTYPE >
bool remove (const KEYTYPE &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
template<class KEYTYPE , class VALUETYPE >
bool remove (const KEYTYPE &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing both key and value to be a const char*. More...
 
virtual bool remove (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Cacheable > &value, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Removes the entry with the specified key, value and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
template<class VALUETYPE >
bool remove (const std::shared_ptr< CacheableKey > &key, const VALUETYPE &value, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing value to be a const char*. More...
 
virtual void removeAll (const std::vector< std::shared_ptr< CacheableKey > > &keys, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Removes all of the entries for the specified keys from this region. More...
 
template<class KEYTYPE >
bool removeEx (const KEYTYPE &key, const std::shared_ptr< Serializable > &arg=nullptr)
 Convenience method allowing key to be a const char*. More...
 
virtual bool removeEx (const std::shared_ptr< CacheableKey > &key, const std::shared_ptr< Serializable > &aCallbackArgument=nullptr)=0
 Removes the entry with the specified key and provides a user-defined parameter object to any CacheWriter invoked in the process. More...
 
virtual std::shared_ptr< SerializableselectValue (const std::string &predicate, std::chrono::milliseconds timeout=DEFAULT_QUERY_RESPONSE_TIMEOUT)=0
 Executes the query on the server based on the predicate and returns a single result value. More...
 
virtual std::vector< std::shared_ptr< CacheableKey > > serverKeys ()=0
 Return the set of keys defined in the server process associated to this client and region. More...
 
virtual uint32_t size ()=0
 Get the size of region. More...
 
virtual std::vector< std::shared_ptr< Region > > subregions (const bool recursive)=0
 Populates the passed in std::vector<std::shared_ptr<Region>> with subregions of the current region. More...
 
virtual void unregisterAllKeys ()=0
 Registers to get updates for all keys from the server. More...
 
virtual void unregisterKeys (const std::vector< std::shared_ptr< CacheableKey > > &keys)=0
 Unregisters an array of keys to stop getting updates for them. More...
 
virtual void unregisterRegex (const std::string &regex)=0
 Unregisters a regular expression to stop getting updates for keys from the server. More...
 
virtual std::vector< std::shared_ptr< Cacheable > > values ()=0
 Return all values in the local process for this region. More...
 

Detailed Description

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 Region 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 space and object grouping.

A region's name can be any String, except that it should 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 Region::getSubregion. You can get the relative path from the root region with Region::getFullPath. The name separator is used to concatenate all the region names together from the root, starting with the root's subregions.

See also
RegionAttributes

Member Function Documentation

◆ clear()

virtual void apache::geode::client::Region::clear ( const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr)
pure virtual

Removes all entries from this region and provides a user-defined parameter object to any CacheWriter or CacheListener invoked in the process.

See also
CacheListener::afterRegionClear
CacheWriter::beforeRegionClear

◆ containsKey() [1/2]

template<class KEYTYPE >
bool apache::geode::client::Region::containsKey ( const KEYTYPE &  key) const
inline

Convenience method allowing key to be a const char* This operations checks for the key in the local cache .

It is not propagated to the Geode cache server to which it is connected.

◆ containsKey() [2/2]

virtual bool apache::geode::client::Region::containsKey ( const std::shared_ptr< CacheableKey > &  keyPtr) const
pure virtual

Only the client's cache is searched for the key.

It does not go to the java server to which it is connected with.

◆ containsKeyOnServer()

virtual bool apache::geode::client::Region::containsKeyOnServer ( const std::shared_ptr< CacheableKey > &  keyPtr) const
pure virtual

The cache of the server, to which it is connected with, is searched for the key to see if the key is present.

Exceptions
UnsupportedOperationExceptionif the region's scope is ScopeType::LOCAL.

◆ containsValueForKey() [1/2]

template<class KEYTYPE >
bool apache::geode::client::Region::containsValueForKey ( const KEYTYPE &  key) const
inline

Convenience method allowing key to be a const char* This operations checks for the value in the local cache .

It is not propagated to the Geode cache server to which it is connected.

◆ containsValueForKey() [2/2]

virtual bool apache::geode::client::Region::containsValueForKey ( const std::shared_ptr< CacheableKey > &  keyPtr) const
pure virtual

This operations checks for the value in the local cache .

It is not propagated to the Geode cache server to which it is connected.

◆ create() [1/4]

template<class KEYTYPE >
void apache::geode::client::Region::create ( const KEYTYPE &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ create() [2/4]

template<class KEYTYPE , class VALUETYPE >
void apache::geode::client::Region::create ( const KEYTYPE &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing both key and value to be a const char*.

◆ create() [3/4]

virtual void apache::geode::client::Region::create ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Creates a new entry in this region with the specified key and value, providing a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener, if one is defined for this Region, invoked in the process. The new entry is propogated to the java server also to which it is connected with.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime 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
keythe key smart pointer for which to create the entry in this region.
valuethe value for the new entry, which may be nullptr meaning the new entry starts as if it had been locally invalidated.
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. Should be serializable if passed to remote callback events
Exceptions
IllegalArgumentExceptionif key is nullptr or if the key, value, or aCallbackArgument do not meet serializability requirements
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
RegionDestroyedExceptionif region is no longer valid
CacheServerExceptionIf an exception is received from the Java cache server. Only for Native Client regions.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif the operation timed out
OutOfMemoryExceptionif no memory for new entry
EntryExistsExceptionif an entry with this key already exists

◆ create() [4/4]

template<class VALUETYPE >
void apache::geode::client::Region::create ( const std::shared_ptr< CacheableKey > &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing value to be a const char*.

◆ createSubregion()

virtual std::shared_ptr< Region > apache::geode::client::Region::createSubregion ( const std::string &  subregionName,
RegionAttributes  aRegionAttributes 
)
pure virtual

Creates a subregion with the specified attributes.

◆ destroy() [1/2]

template<class KEYTYPE >
void apache::geode::client::Region::destroy ( const KEYTYPE &  key,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ destroy() [2/2]

virtual void apache::geode::client::Region::destroy ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Destroys the entry with the specified key, and provides a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener, if one is defined for this Region, invoked in the process. Destroy removes not only the value, but also the key and entry from this region.

The destroy is propogated to the Geode cache server to which it is connected with. If the destroy fails due to an exception on server throwing back CacheServerException or security exception, then the local entry is still destroyed.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the entry to destroy
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. If it is sent on the wire, it has to be Serializable.
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
CacheServerExceptionIf an exception is received from the Geode cache server. Only for Native Client regions.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif the operation timed out
RegionDestroyedExceptionif the region is destroyed.
EntryNotFoundExceptionif the entry does not exist in this region.
See also
invalidate
CacheListener::afterDestroy
CacheWriter::beforeDestroy

◆ destroyRegion()

virtual void apache::geode::client::Region::destroyRegion ( const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr)
pure virtual

Destroys the whole region and provides a user-defined parameter object to any CacheWriter invoked in the process.

Destroy cascades to all entries and subregions. After the destroy, this region object cannot be used any more. Any attempt to use this region object will get a RegionDestroyedException exception.

The region destroy not only destroys the local region but also destroys the server region. However, if server region destroy fails throwing back CacheServerException or security exception, the local region is still destroyed.

Parameters
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this call. Can be nullptr. If it is sent on the wire, it has to be Serializable.
Exceptions
CacheWriterExceptionif CacheWriter aborts the operation; if this occurs some subregions may have already been successfully destroyed.
CacheListenerExceptionif CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated
CacheServerExceptionIf an exception is received from the Java cache server. Only for Native Client regions.
NotConnectedExceptionif 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif operation timed out
See also
invalidateRegion

◆ existsValue()

virtual bool apache::geode::client::Region::existsValue ( const std::string &  predicate,
std::chrono::milliseconds  timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT 
)
pure virtual

Executes the query on the server based on the predicate and returns whether any result exists.

Valid only for a Native Client region.

Parameters
predicateThe query predicate (just the WHERE clause) or the entire query to execute.
timeoutThe time to wait for the response, optional.
Exceptions
IllegalArgumentExceptionIf timeout exceeds 2147483647ms.
QueryExceptionif some query error occurred at the server.
NotConnectedExceptionif a server connection error occurs. For pools configured with locators, if no locators are available, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf the message received from server could not be handled. This will be the case when the reply is not well formed. More information can be found in the log.
TimeoutExceptionif operation timed out
CacheClosedExceptionif the cache has been closed
Returns
true if the result size is non-zero, false otherwise.

◆ get() [1/2]

template<class KEYTYPE >
std::shared_ptr< Cacheable > apache::geode::client::Region::get ( const KEYTYPE &  key,
const std::shared_ptr< Serializable > &  callbackArg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ get() [2/2]

virtual std::shared_ptr< Cacheable > apache::geode::client::Region::get ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Returns the value associated with the specified key, passing the callback argument to any cache loaders that are invoked in the operation.

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::getLastAccessedTime, CacheStatistics::getHitCount, CacheStatistics::getMissCount, and CacheStatistics::getLastModifiedTime (if a new value is loaded) for this region and the entry.

Parameters
keywhose associated value is to be returned. The key Object must implement the equals and hashCode methods.
aCallbackArgumentan argument passed into the CacheLoader if loader is used. If it is sent on the wire, it has to be Serializable.
Exceptions
IllegalArgumentExceptionif key is nullptr or aCallbackArgument is not serializable and a remote CacheLoader needs to be invoked
CacheLoaderExceptionif CacheLoader throws an exception
CacheServerExceptionIf an exception is received from the Java cache server. Only for Native Client regions.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif operation timed out
RegionDestroyedExceptionif the method is called on a destroyed region

◆ getAll()

virtual HashMapOfCacheable apache::geode::client::Region::getAll ( const std::vector< std::shared_ptr< CacheableKey > > &  keys,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Gets values for an array 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.

Updates the CacheStatistics::getLastAccessedTime, CacheStatistics::getHitCount and CacheStatistics::getMissCount for this region and the entry.

Parameters
keysthe array of keys
valuesOutput parameter that provides the map of keys to respective values. It is ignored if nullptr, and when nullptr then at least the addToLocalCache parameter should be true and caching should be enabled for the region to get values into the region otherwise an IllegalArgumentException is thrown.
exceptionsOutput parameter that provides the map of keys to any exceptions while obtaining the key. It is ignored if nullptr.
Since
8.1
Parameters
aCallbackArgumentan argument that is passed to the callback functions. It may be nullptr. Must be serializable if this operation is distributed.
Exceptions
IllegalArgumentExceptionIf the array of keys is empty. Other invalid case is when the values parameter is nullptr, and either addToLocalCache is false or caching is disabled for this region.
CacheServerExceptionIf an exception is received from the Java cache server while processing the request.
NotConnectedExceptionif it 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
RegionDestroyedExceptionIf region destroy is pending.
TimeoutExceptionif operation timed out.
UnknownExceptionFor other exceptions.
See also
get

◆ getAttributes()

virtual const RegionAttributes & apache::geode::client::Region::getAttributes ( ) const
pure virtual

Return the RegionAttributes for this region.

◆ getAttributesMutator()

virtual std::shared_ptr< AttributesMutator > apache::geode::client::Region::getAttributesMutator ( ) const
pure virtual

Return the a mutator object for changing a subset of the region attributes.

Exceptions
RegionDestroyedException.

◆ getEntry() [1/2]

template<class KEYTYPE >
std::shared_ptr< RegionEntry > apache::geode::client::Region::getEntry ( const KEYTYPE &  key)
inline

Convenience method allowing key to be a const char*.

◆ getEntry() [2/2]

virtual std::shared_ptr< RegionEntry > apache::geode::client::Region::getEntry ( const std::shared_ptr< CacheableKey > &  key)
pure virtual

Return the meta-object RegionEntry for key.

Exceptions
IllegalArgumentException,RegionDestroyedException.

◆ getFullPath()

virtual const std::string & apache::geode::client::Region::getFullPath ( ) const
pure virtual

return the full path of the region as can be used to lookup the region from Cache::getRegion.

The storage is backed by the region.

◆ getInterestList()

virtual std::vector< std::shared_ptr< CacheableKey > > apache::geode::client::Region::getInterestList ( ) const
pure virtual

Returns the list of keys on which this client is interested and will be notified of changes.

Exceptions
UnsupportedOperationExceptionif the region's scope is ScopeType::LOCAL.

◆ getInterestListRegex()

virtual std::vector< std::shared_ptr< CacheableString > > apache::geode::client::Region::getInterestListRegex ( ) const
pure virtual

Returns the list of regular expresssions on which this client is interested and will be notified of changes.

Exceptions
UnsupportedOperationExceptionif the region's scope is ScopeType::LOCAL.

◆ getName()

virtual const std::string & apache::geode::client::Region::getName ( ) const
pure virtual

Public Methods.

return single name of region. The storage is backed by the region.

◆ getParentRegion()

virtual std::shared_ptr< Region > apache::geode::client::Region::getParentRegion ( ) const
pure virtual

Returns the parent region, or nullptr if a root region.

Exceptions
RegionDestroyedException

◆ getRegionService()

virtual RegionService & apache::geode::client::Region::getRegionService ( ) const
pure virtual

Returns the cache associated with this region.

Returns
the cache

◆ getSubregion()

virtual std::shared_ptr< Region > apache::geode::client::Region::getSubregion ( const std::string &  path)
pure virtual

Returns the subregion identified by the path, nullptr if no such subregion.

◆ invalidate() [1/2]

template<class KEYTYPE >
void apache::geode::client::Region::invalidate ( const KEYTYPE &  key,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ invalidate() [2/2]

virtual void apache::geode::client::Region::invalidate ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Invalidates the entry with the specified key, and provides a user-defined argument to the CacheListener.

Invalidate only removes the value from the entry, the key is kept intact. To completely remove the entry, destroy should be used. The invalidate is not propogated to the Geode cache server to which it is connected with.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the value to be invalidated
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. Should be serializable if passed to remote callback events
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheListenerExceptionif CacheListener throws an exception
EntryNotFoundExceptionif this entry does not exist in this region locally
RegionDestroyedExceptionif the region is destroyed
See also
destroy
CacheListener::afterInvalidate

◆ invalidateRegion()

virtual void apache::geode::client::Region::invalidateRegion ( const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr)
pure virtual

Invalidates this region.

The invalidation will cascade to all the subregions and cached entries. After the invalidateRegion , the region and the entries in it still exist. In order to remove all the entries and the region, destroyRegion should be used.

Parameters
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. If it is sent on the wire, it has to be Serializable.
Exceptions
CacheListenerExceptionif CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated
RegionDestroyedExceptionif the region is no longer valid
See also
destroyRegion
CacheListener::afterRegionInvalidate This operation is not distributed.

◆ keys()

virtual std::vector< std::shared_ptr< CacheableKey > > apache::geode::client::Region::keys ( )
pure virtual

Return all the keys in the local process for this region.

This includes keys for which the entry is invalid.

◆ localClear()

virtual void apache::geode::client::Region::localClear ( const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr)
pure virtual

Removes all entries from this region and provides a user-defined parameter object to any CacheWriter or CacheListener invoked in the process.

Clear will not be distributed to other caches.

See also
CacheListener::afterRegionClear
CacheWriter::beforeRegionClear

◆ localCreate() [1/4]

template<class KEYTYPE >
void apache::geode::client::Region::localCreate ( const KEYTYPE &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ localCreate() [2/4]

template<class KEYTYPE , class VALUETYPE >
void apache::geode::client::Region::localCreate ( const KEYTYPE &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing both key and value to be a const char*.

◆ localCreate() [3/4]

virtual void apache::geode::client::Region::localCreate ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Creates a new entry in this region with the specified key and value in the local cache only, providing a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener, if one is defined for this Region, invoked in the process.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key smart pointer for which to create the entry in this region.
valuethe value for the new entry, which may be nullptr meaning the new entry starts as if it had been locally invalidated.
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. Should be serializable if passed to remote callback events
Exceptions
IllegalArgumentExceptionif key or value is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
RegionDestroyedExceptionif region is no longer valid
OutOfMemoryExceptionif no memory for new entry
EntryExistsExceptionif an entry with this key already exists

◆ localCreate() [4/4]

template<class VALUETYPE >
void apache::geode::client::Region::localCreate ( const std::shared_ptr< CacheableKey > &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing value to be a const char*.

◆ localDestroy() [1/2]

template<class KEYTYPE >
void apache::geode::client::Region::localDestroy ( const KEYTYPE &  key,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ localDestroy() [2/2]

virtual void apache::geode::client::Region::localDestroy ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Destroys the entry with the specified key in the local cache only, and provides a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener, if one is defined for this Region, invoked in the process. Destroy removes not only the value but also the key and entry from this region.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the entry to destroy.
aCallbackArgumentthe callback for user to pass in, default is nullptr.
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
EntryNotFoundExceptionif the entry does not exist in this region locally
See also
invalidate
CacheListener::afterDestroy
CacheWriter::beforeDestroy

◆ localDestroyRegion()

virtual void apache::geode::client::Region::localDestroyRegion ( const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr)
pure virtual

Destroys the whole region and provides a user-defined parameter object to any CacheWriter invoked in the process.

Destroy cascades to all entries and subregions. After the destroy, this region object cannot be used any more. Any attempt to use this region object will get a RegionDestroyedException exception. The region destroy is not distributed to other caches.

Parameters
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this call. Can be nullptr. If it is sent on the wire, it has to be Serializable.
Exceptions
CacheWriterExceptionif CacheWriter aborts the operation; if this occurs some subregions may have already been successfully destroyed.
CacheListenerExceptionif CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated
See also
localInvalidateRegion

◆ localInvalidate() [1/2]

template<class KEYTYPE >
void apache::geode::client::Region::localInvalidate ( const KEYTYPE &  key,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ localInvalidate() [2/2]

virtual void apache::geode::client::Region::localInvalidate ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Invalidates the entry with the specified key in the local cache only, and provides a user-defined argument to the CacheListener.

Invalidate only removes the value from the entry, the key is kept intact. To completely remove the entry, destroy should be used.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the value to be invalidated
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. Should be serializable if passed to remote callback events
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheListenerExceptionif CacheListener throws an exception
EntryNotFoundExceptionif this entry does not exist in this region locally
RegionDestroyedExceptionif the region is destroyed
See also
destroy
CacheListener::afterInvalidate

◆ localInvalidateRegion()

virtual void apache::geode::client::Region::localInvalidateRegion ( const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr)
pure virtual

Invalidates this region.

The invalidation will cascade to all the subregions and cached entries. After the invalidateRegion , the region and the entries in it still exist. In order to remove all the entries and the region, destroyRegion should be used. The region invalidate will not be distributed to other caches

Parameters
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. If it is sent on the wire, it has to be Serializable.
Exceptions
CacheListenerExceptionif CacheListener throws an exception; if this occurs some subregions may have already been successfully invalidated
RegionDestroyedExceptionif the region is no longer valid
See also
destroyRegion
CacheListener::afterRegionInvalidate

◆ localPut() [1/4]

template<class KEYTYPE >
void apache::geode::client::Region::localPut ( const KEYTYPE &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ localPut() [2/4]

template<class KEYTYPE , class VALUETYPE >
void apache::geode::client::Region::localPut ( const KEYTYPE &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing both key and value to be a const char*.

◆ localPut() [3/4]

virtual void apache::geode::client::Region::localPut ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Places a new value into an entry in this region with the specified key in the local cache only, providing a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener, if one is defined for this Region, invoked in the process. If there is already an entry associated with the specified key in this region, the entry's previous value is overwritten.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keya key smart pointer associated with the value to be put into this region.
valuethe value to be put into the cache
aCallbackArgumentan argument that is passed to the callback functions
Exceptions
IllegalArgumentExceptionif key or value is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
RegionDestroyedExceptionif region no longer valid
OutOfMemoryExceptionif not enoough memory for the value

◆ localPut() [4/4]

template<class VALUETYPE >
void apache::geode::client::Region::localPut ( const std::shared_ptr< CacheableKey > &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing value to be a const char*.

◆ localRemove() [1/4]

template<class KEYTYPE >
bool apache::geode::client::Region::localRemove ( const KEYTYPE &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ localRemove() [2/4]

template<class KEYTYPE , class VALUETYPE >
bool apache::geode::client::Region::localRemove ( const KEYTYPE &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing both key and value to be a const char*.

◆ localRemove() [3/4]

virtual bool apache::geode::client::Region::localRemove ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Removes the entry with the specified key and value in the local cache only, and provides a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener and CacheWriter, if one is defined for this Region, invoked in the process. Remove removes not only the value but also the key and entry from this region.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the entry to remove.
valuethe value of the entry to remove.
aCallbackArgumentthe callback for user to pass in, default is nullptr.
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
Returns
the boolean true if an entry(key, value)has been removed or false if an entry(key, value) has not been removed.
See also
destroy
CacheListener::afterDestroy
CacheWriter::beforeDestroy

◆ localRemove() [4/4]

template<class VALUETYPE >
bool apache::geode::client::Region::localRemove ( const std::shared_ptr< CacheableKey > &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing value to be a const char*.

◆ localRemoveEx() [1/2]

template<class KEYTYPE >
bool apache::geode::client::Region::localRemoveEx ( const KEYTYPE &  key,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ localRemoveEx() [2/2]

virtual bool apache::geode::client::Region::localRemoveEx ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Removes the entry with the specified key in the local cache only, and provides a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener and CacheWriter, if one is defined for this Region, invoked in the process. Remove removes not only the value but also the key and entry from this region.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the entry to remove.
aCallbackArgumentthe callback for user to pass in, default is nullptr.
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
Returns
the boolean true if an entry(key, value)has been removed or false if an entry(key, value) has not been removed.
See also
destroy
CacheListener::afterDestroy
CacheWriter::beforeDestroy

◆ put() [1/4]

template<class KEYTYPE >
void apache::geode::client::Region::put ( const KEYTYPE &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ put() [2/4]

template<class KEYTYPE , class VALUETYPE >
void apache::geode::client::Region::put ( const KEYTYPE &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing both key and value to be a const char*.

◆ put() [3/4]

virtual void apache::geode::client::Region::put ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Places a new value into an entry in this region with the specified key, providing a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener, if one is defined for this Region, invoked in the process. 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 with.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime 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
keya key smart pointer associated with the value to be put into this region.
valuethe value to be put into the cache
aCallbackArgumentan argument that is passed to the callback function
Exceptions
IllegalArgumentExceptionif key or value is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
RegionDestroyedExceptionif region no longer valid
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif operation timed out
OutOfMemoryExceptionif not enoough memory for the value

◆ put() [4/4]

template<class VALUETYPE >
void apache::geode::client::Region::put ( const std::shared_ptr< CacheableKey > &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing value to be a const char*.

◆ putAll()

virtual void apache::geode::client::Region::putAll ( const HashMapOfCacheable &  map,
std::chrono::milliseconds  timeout = DEFAULT_RESPONSE_TIMEOUT,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Places a set of new values in this region with the specified keys given as a map of key/value pairs.

If there is already an entry associated with a specified key in this region, the entry's previous value is overwritten.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entries.

Parameters
mapA hashmap containing key-value pairs
timeoutThe time to wait for the response, optional.
aCallbackArgumentan argument that is passed to the callback functions. It is ignored if nullptr. It must be serializable if this operation is distributed.
Exceptions
IllegalArgumentExceptionIf timeout exceeds 2147483647ms.
Since
8.1

◆ query()

virtual std::shared_ptr< SelectResults > apache::geode::client::Region::query ( const std::string &  predicate,
std::chrono::milliseconds  timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT 
)
pure virtual

Executes the query on the server based on the predicate.

Valid only for a Native Client region.

Parameters
predicateThe query predicate (just the WHERE clause) or the entire query to execute.
timeoutThe time to wait for the query response, optional.
Exceptions
IllegalArgumentExceptionIf timeout exceeds 2147483647ms.
QueryExceptionif some query error occurred at the server.
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif a server connection error occurs. For pools configured with locators, if no locators are available, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif operation timed out
CacheClosedExceptionif the cache has been closed
Returns
A smart pointer to the SelectResults which can either be a ResultSet or a StructSet.

◆ registerAllKeys()

virtual void apache::geode::client::Region::registerAllKeys ( bool  isDurable = false,
bool  getInitialValues = false,
bool  receiveValues = true 
)
pure virtual

Registers to get updates for all keys from the server.

Parameters
isDurableflag to indicate whether this is a durable registration
getInitialValuestrue to populate the cache with values of all keys from the server
receiveValueswhether to act like notify-by-subscription is set
Exceptions
EntryNotFoundExceptionIf an exception occurs while obtaining values from server after register interest is complete. The actual cause of the exception can be obtained using Exception::getCause. If an application wants to undo the registration on server, or take some other steps for the incomplete cache population then this is the exception that should be caught.
UnsupportedOperationExceptionIf the region is not a Native Client region
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
RegionDestroyedExceptionIf region destroy is pending.
UnknownExceptionFor other exceptions.
TimeoutExceptionif operation timed out

◆ registerKeys()

virtual void apache::geode::client::Region::registerKeys ( const std::vector< std::shared_ptr< CacheableKey > > &  keys,
bool  isDurable = false,
bool  getInitialValues = false,
bool  receiveValues = true 
)
pure virtual

Registers an array of keys for getting updates from the server.

Parameters
keysthe array of keys
isDurableflag to indicate whether this is a durable registration
getInitialValuestrue to populate the cache with values of the keys that were registered on the server
receiveValueswhether to act like notify-by-subscription is set
Exceptions
IllegalArgumentExceptionIf the array of keys is empty.
IllegalStateExceptionIf already registered interest for all keys.
EntryNotFoundExceptionIf an exception occurs while obtaining values from server after register interest is complete. The actual cause of the exception can be obtained using Exception::getCause. If an application wants to undo the registration on server, or take some other steps for the incomplete cache population then this is the exception that should be caught.
UnsupportedOperationExceptionIf the region is not a Native Client region
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
RegionDestroyedExceptionIf region destroy is pending.
UnknownExceptionFor other exceptions.
TimeoutExceptionif operation timed out

◆ registerRegex()

virtual void apache::geode::client::Region::registerRegex ( const std::string &  regex,
bool  isDurable = false,
bool  getInitialValues = false,
bool  receiveValues = true 
)
pure virtual

Registers a regular expression to match with keys to get updates from the server.

Parameters
regexThe regular expression string.
isDurableflag to indicate whether this is a durable registration
getInitialValuestrue to populate the cache with values of the keys that were registered on the server
receiveValueswhether to act like notify-by-subscription is set
Exceptions
IllegalArgumentExceptionIf regex is empty.
IllegalStateExceptionIf already registered interest for all keys.
EntryNotFoundExceptionIf an exception occurs while obtaining values from server after register interest is complete. The actual cause of the exception can be obtained using Exception::getCause. If an application wants to undo the registration on server, or take some other steps for the incomplete cache population then this is the exception that should be caught.
UnsupportedOperationExceptionIf the region is not a Native Client region
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
RegionDestroyedExceptionIf region destroy is pending.
UnknownExceptionFor other exceptions.
TimeoutExceptionif operation timed out

◆ remove() [1/5]

template<class KEYTYPE >
bool apache::geode::client::Region::remove ( const KEYTYPE &  key)
inline

Convenience method allowing both key and value to be a const char*.

◆ remove() [2/5]

template<class KEYTYPE >
bool apache::geode::client::Region::remove ( const KEYTYPE &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ remove() [3/5]

template<class KEYTYPE , class VALUETYPE >
bool apache::geode::client::Region::remove ( const KEYTYPE &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing both key and value to be a const char*.

◆ remove() [4/5]

virtual bool apache::geode::client::Region::remove ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Cacheable > &  value,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Removes the entry with the specified key, value and provides a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener and CacheWriter, if one is defined for this Region, invoked in the process. remove removes not only the value, but also the key and entry from this region.

The remove is propogated to the Geode cache server to which it is connected with. If the destroy fails due to an exception on server throwing back CacheServerException or security exception, then the local entry is still removed.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the entry to remove
valuethe value of the key to remove, it can be nullptr.
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. If it is sent on the wire, it has to be Serializable.
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
CacheServerExceptionIf an exception is received from the Geode cache server. Only for Native Client regions.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif the operation timed out
RegionDestroyedExceptionif the region is destroyed.
Returns
the boolean true if an entry(key, value)has been removed or false if an entry(key, value) has not been removed.
See also
destroy
CacheListener::afterDestroy
CacheWriter::beforeDestroy

◆ remove() [5/5]

template<class VALUETYPE >
bool apache::geode::client::Region::remove ( const std::shared_ptr< CacheableKey > &  key,
const VALUETYPE &  value,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing value to be a const char*.

◆ removeAll()

virtual void apache::geode::client::Region::removeAll ( const std::vector< std::shared_ptr< CacheableKey > > &  keys,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Removes all of the entries for the specified keys from this region.

The effect of this call is equivalent to that of calling destroy 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.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entries.

Since
8.1
Parameters
keysthe keys to remove from this region.
aCallbackArgumentan argument that is passed to the callback functions. It is ignored if nullptr. It must be serializable if this operation is distributed.
Exceptions
IllegalArgumentExceptionIf the array of keys is empty.
CacheServerExceptionIf an exception is received from the Java cache server while processing the request.
NotConnectedExceptionif it 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
RegionDestroyedExceptionIf region destroy is pending.
TimeoutExceptionif operation timed out.
UnknownExceptionFor other exceptions.
See also
destroy

◆ removeEx() [1/2]

template<class KEYTYPE >
bool apache::geode::client::Region::removeEx ( const KEYTYPE &  key,
const std::shared_ptr< Serializable > &  arg = nullptr 
)
inline

Convenience method allowing key to be a const char*.

◆ removeEx() [2/2]

virtual bool apache::geode::client::Region::removeEx ( const std::shared_ptr< CacheableKey > &  key,
const std::shared_ptr< Serializable > &  aCallbackArgument = nullptr 
)
pure virtual

Removes the entry with the specified key and provides a user-defined parameter object to any CacheWriter invoked in the process.

The same parameter is also passed to the CacheListener and CacheWriter, if one is defined for this Region, invoked in the process. remove removes not only the value, but also the key and entry from this region.

The remove is propogated to the Geode cache server to which it is connected with. If the destroy fails due to an exception on server throwing back CacheServerException or security exception, then the local entry is still removed.

Updates the CacheStatistics::getLastAccessedTime and CacheStatistics::getLastModifiedTime for this region and the entry.

Parameters
keythe key of the entry to remove
aCallbackArgumenta user-defined parameter to pass to callback events triggered by this method. Can be nullptr. If it is sent on the wire, it has to be Serializable.
Exceptions
IllegalArgumentExceptionif key is nullptr
CacheWriterExceptionif CacheWriter aborts the operation
CacheListenerExceptionif CacheListener throws an exception
CacheServerExceptionIf an exception is received from the Geode cache server. Only for Native Client regions.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif the operation timed out
RegionDestroyedExceptionif the region is destroyed.
Returns
the boolean true if an entry(key, value)has been removed or false if an entry(key, value) has not been removed.
See also
destroy
CacheListener::afterDestroy
CacheWriter::beforeDestroy

◆ selectValue()

virtual std::shared_ptr< Serializable > apache::geode::client::Region::selectValue ( const std::string &  predicate,
std::chrono::milliseconds  timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT 
)
pure virtual

Executes the query on the server based on the predicate and returns a single result value.

Valid only for a Native Client region.

Parameters
predicateThe query predicate (just the WHERE clause) or the entire query to execute.
timeoutThe time to wait for the response, optional.
Exceptions
IllegalArgumentExceptionIf timeout exceeds 2147483647ms.
QueryExceptionif some query error occurred at the server, or more than one result items are available.
NotConnectedExceptionif a server connection error occurs. For pools configured with locators, if no locators are available, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif operation timed out
CacheClosedExceptionif the cache has been closed
Returns
A smart pointer to the single ResultSet or StructSet item, or nullptr of no results are available.

◆ serverKeys()

virtual std::vector< std::shared_ptr< CacheableKey > > apache::geode::client::Region::serverKeys ( )
pure virtual

Return the set of keys defined in the server process associated to this client and region.

If a server has the region defined as a mirror, then this will be the entire keyset for the region across all PEER in the distributed system. The vector v will contain only the server keys. Any prior contents in the vector will be removed.

Exceptions
CacheServerExceptionIf an exception is received from the Geode cache server. Only for Native Client regions.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
MessageExceptonIf 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.
TimeoutExceptionif there is a timeout getting the keys
UnsupportedOperationExceptionif the member type is not CLIENT or region is not a native client one.

◆ size()

virtual uint32_t apache::geode::client::Region::size ( )
pure virtual

Get the size of region.

For native client regions, this will give the number of entries in the local cache and not on the servers.

◆ subregions()

virtual std::vector< std::shared_ptr< Region > > apache::geode::client::Region::subregions ( const bool  recursive)
pure virtual

Populates the passed in std::vector<std::shared_ptr<Region>> with subregions of the current region.

Parameters
recursivedetermines whether the method recursively fills in subregions
Exceptions
RegionDestroyedException

◆ unregisterAllKeys()

virtual void apache::geode::client::Region::unregisterAllKeys ( )
pure virtual

Registers to get updates for all keys from the server.

Exceptions
IllegalStateExceptionIf not previously registered all keys.
UnsupportedOperationExceptionIf the region is not a Native Client region
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
RegionDestroyedExceptionIf region destroy is pending.
UnknownExceptionFor other exceptions.
TimeoutExceptionif operation timed out

◆ unregisterKeys()

virtual void apache::geode::client::Region::unregisterKeys ( const std::vector< std::shared_ptr< CacheableKey > > &  keys)
pure virtual

Unregisters an array of keys to stop getting updates for them.

Parameters
keysthe array of keys
Exceptions
IllegalArgumentExceptionIf the array of keys is empty.
IllegalStateExceptionIf no keys were previously registered.
UnsupportedOperationExceptionIf the region is not a Native Client region
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
RegionDestroyedExceptionIf region destroy is pending.
UnknownExceptionFor other exceptions.
TimeoutExceptionif operation timed out

◆ unregisterRegex()

virtual void apache::geode::client::Region::unregisterRegex ( const std::string &  regex)
pure virtual

Unregisters a regular expression to stop getting updates for keys from the server.

Parameters
regexThe regular expression string.
Exceptions
IllegalArgumentExceptionIf regex is empty.
IllegalStateExceptionIf not previously registered this regular expression string.
UnsupportedOperationExceptionIf the region is not a Native Client region
CacheServerExceptionIf an exception is received from the Java cache server.
NotConnectedExceptionif it is not connected to the cache 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, the cause of NotConnectedException is set to NoAvailableLocatorsException.
RegionDestroyedExceptionIf region destroy is pending.
UnknownExceptionFor other exceptions.
TimeoutExceptionif operation timed out

◆ values()

virtual std::vector< std::shared_ptr< Cacheable > > apache::geode::client::Region::values ( )
pure virtual

Return all values in the local process for this region.

No value is included for entries that are invalidated.


Apache Geode C++ Cache API Documentation