VMware GemFire Native C++ Reference  9.1
apache::geode::client::Cache Class Reference

Cache are obtained from create method on the CacheFactory#create class. More...

Inherits apache::geode::client::GeodeCache.

Public Member Functions

virtual void close ()
 Terminates this object cache and releases all the local resources. More...
 
virtual void close (bool keepalive)
 Terminates this object cache and releases all the local resources. More...
 
virtual RegionServicePtr createAuthenticatedView (PropertiesPtr userSecurityProperties, const char *poolName=NULL)
 Creates an authenticated cache using the given user security properties. More...
 
virtual PdxInstanceFactoryPtr createPdxInstanceFactory (const char *className)
 Returns a factory that can create a PdxInstance. More...
 
virtual RegionFactoryPtr createRegionFactory (RegionShortcut regionShortcut)
 public methods More...
 
virtual CacheTransactionManagerPtr getCacheTransactionManager ()
 Get the CacheTransactionManager instance for this Cache. More...
 
virtual DistributedSystemPtr getDistributedSystem () const
 Returns the distributed system that this cache was created with. More...
 
virtual const char * getName () const
 Returns the name of this cache. More...
 
virtual bool getPdxIgnoreUnreadFields ()
 Returns whether Cache saves unread fields for Pdx types. More...
 
virtual bool getPdxReadSerialized ()
 Returns whether PdxInstance is preferred for PDX types instead of C++ object. More...
 
virtual QueryServicePtr getQueryService ()
 Gets the QueryService from which a new Query can be obtained. More...
 
virtual QueryServicePtr getQueryService (const char *poolName)
 Gets the QueryService from which a new Query can be obtained. More...
 
virtual RegionPtr getRegion (const char *path)
 Look up a region with the full path from root. More...
 
virtual void initializeDeclarativeCache (const char *cacheXml)
 Initializes the cache from an xml file. More...
 
virtual bool isClosed () const
 Indicates if this cache has been closed. More...
 
void preserveSB () const
 Atomically increment reference count. More...
 
virtual void readyForEvents ()
 Send the "client ready" message to the server from a durable client. More...
 
int32_t refCount ()
 
void releaseSB () const
 Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero. More...
 
virtual void rootRegions (VectorOfRegion &regions)
 Returns a set of root regions in the cache. More...
 
virtual ~Cache ()
 destructor More...
 

Detailed Description

Cache are obtained from create method on the CacheFactory#create class.

When a cache will no longer be used, it should be closed. Once it is closed any attempt to use it will cause a CacheClosedException to be thrown.

A cache can have multiple root regions, each with a different name.

Constructor & Destructor Documentation

virtual apache::geode::client::Cache::~Cache ( )
virtual

destructor

Member Function Documentation

virtual void apache::geode::client::Cache::close ( )
virtual

Terminates this object cache and releases all the local resources.

After this cache is closed, any further method call on this cache or any region object will throw CacheClosedException, unless otherwise noted. If Cache instance created from Pool(pool is in multiuser mode), then it reset user related security data.

Exceptions
CacheClosedException,ifthe cache is already closed.

Implements apache::geode::client::RegionService.

virtual void apache::geode::client::Cache::close ( bool  keepalive)
virtual

Terminates this object cache and releases all the local resources.

After this cache is closed, any further method call on this cache or any region object will throw CacheClosedException, unless otherwise noted. If Cache instance created from Pool(pool is in multiuser mode), then it reset user related security data.

Parameters
keepalivewhether to keep a durable client's queue alive
Exceptions
CacheClosedException,ifthe cache is already closed.
virtual RegionServicePtr apache::geode::client::Cache::createAuthenticatedView ( PropertiesPtr  userSecurityProperties,
const char *  poolName = NULL 
)
virtual

Creates an authenticated cache using the given user security properties.

Multiple instances with different user properties can be created with a single client cache.

Application must use this instance to do operations, when multiuser-authentication is set to true.

See also
RegionService
PoolFactory::setMultiuserAuthentication(boolean)
Returns
the RegionService instance associated with a user and given properties.
Exceptions
UnsupportedOperationExceptionwhen invoked with multiuser-authentication as false.
Parameters
userSecurityPropertiesthe security properties of a user.
poolNamethe pool that the users should be authenticated against. Set if there are more than one Pool in Cache.
virtual PdxInstanceFactoryPtr apache::geode::client::Cache::createPdxInstanceFactory ( const char *  className)
virtual

Returns a factory that can create a PdxInstance.

Parameters
classNamethe fully qualified class name that the PdxInstance will become when it is fully deserialized.
Exceptions
IllegalStateExceptionif the className is NULL or invalid.
Returns
the factory

Implements apache::geode::client::RegionService.

virtual RegionFactoryPtr apache::geode::client::Cache::createRegionFactory ( RegionShortcut  regionShortcut)
virtual

public methods

Returns the RegionFactory to create the region. Before creating the Region, one can set region attributes using this instance.

Parameters
regionShortcutTo create the region specific type,
See also
RegionShortcut
virtual CacheTransactionManagerPtr apache::geode::client::Cache::getCacheTransactionManager ( )
virtual

Get the CacheTransactionManager instance for this Cache.

Returns
The CacheTransactionManager instance.
Exceptions
CacheClosedExceptionif the cache is closed.
virtual DistributedSystemPtr apache::geode::client::Cache::getDistributedSystem ( ) const
virtual

Returns the distributed system that this cache was created with.

Implements apache::geode::client::GeodeCache.

virtual const char* apache::geode::client::Cache::getName ( ) const
virtual

Returns the name of this cache.

Returns
the string name of this cache

Implements apache::geode::client::GeodeCache.

virtual bool apache::geode::client::Cache::getPdxIgnoreUnreadFields ( )
virtual

Returns whether Cache saves unread fields for Pdx types.

Implements apache::geode::client::GeodeCache.

virtual bool apache::geode::client::Cache::getPdxReadSerialized ( )
virtual

Returns whether PdxInstance is preferred for PDX types instead of C++ object.

Implements apache::geode::client::GeodeCache.

virtual QueryServicePtr apache::geode::client::Cache::getQueryService ( )
virtual

Gets the QueryService from which a new Query can be obtained.

Returns
A smart pointer to the QueryService.

Implements apache::geode::client::RegionService.

virtual QueryServicePtr apache::geode::client::Cache::getQueryService ( const char *  poolName)
virtual

Gets the QueryService from which a new Query can be obtained.

Parameters
poolNamePass poolname if pool is created from cache.xml or PoolManager
Returns
A smart pointer to the QueryService.
virtual RegionPtr apache::geode::client::Cache::getRegion ( const char *  path)
virtual

Look up a region with the full path from root.

If Pool attached with Region is in multiusersecure mode then don't use return instance of region as no credential are attached with this instance. Get region from RegionService instance of Cache.

See also
Cache::createAuthenticatedView(PropertiesPtr).
Parameters
paththe region's name, such as AuthRegion.
Returns
region, or NULLPTR if no such region exists.

Implements apache::geode::client::RegionService.

virtual void apache::geode::client::Cache::initializeDeclarativeCache ( const char *  cacheXml)
virtual

Initializes the cache from an xml file.

Parameters
cacheXmlValid cache.xml file

Implements apache::geode::client::GeodeCache.

virtual bool apache::geode::client::Cache::isClosed ( ) const
virtual

Indicates if this cache has been closed.

After a new cache object is created, this method returns false; After the close is called on this cache object, this method returns true.

Returns
true, if this cache is closed; false, otherwise

Implements apache::geode::client::RegionService.

void apache::geode::client::SharedBase::preserveSB ( ) const
inherited

Atomically increment reference count.

virtual void apache::geode::client::Cache::readyForEvents ( )
virtual

Send the "client ready" message to the server from a durable client.

int32_t apache::geode::client::SharedBase::refCount ( )
inlineinherited
Returns
the reference count
void apache::geode::client::SharedBase::releaseSB ( ) const
inherited

Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.

virtual void apache::geode::client::Cache::rootRegions ( VectorOfRegion regions)
virtual

Returns a set of root regions in the cache.

This set is a snapshot and is not backed by the Cache. The vector passed in is cleared and the regions are added to it.

Parameters
regionsthe returned set of regions

Implements apache::geode::client::RegionService.


Pivotal GemFire C++ Cache API Documentation