gemfire::Cache Class Reference

Inherits gemfire::GemFireCache.


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.

Public Member Functions

virtual void close (bool keepalive)
 Terminates this object cache and releases all the local resources.
virtual void close ()
 Terminates this object cache and releases all the local resources.
virtual RegionServicePtr createAuthenticatedView (PropertiesPtr userSecurityProperties, const char *poolName=NULL)
 Creates an authenticated cache using the given user security properties.
virtual RegionPtr createRegion (const char *name, const RegionAttributesPtr &aRegionAttributes)
 Returns a region created using the specified RegionAttributes.
virtual RegionFactoryPtr createRegionFactory (RegionShortcut regionShortcut)
virtual
DistributedSystemPtr 
getDistributedSystem () const
 Returns the distributed system that this cache was created with.
virtual const char * getName () const
 Returns the name of this cache.
virtual bool getPdxIgnoreUnreadFields ()
 Returns whther Cache saves unread fields for Pdx types.
virtual bool getPdxReadSerialized ()
 Returns whether PdxInstance is preferred for PDX types instead of C++ object.
virtual QueryServicePtr getQueryService (const char *poolName)
 Gets the QueryService from which a new Query can be obtained.
virtual QueryServicePtr getQueryService ()
 Gets the QueryService from which a new Query can be obtained.
virtual RegionPtr getRegion (const char *path)
 Look up a region with the full path from root.
virtual void initializeDeclarativeCache (const char *cacheXml)
 Initializes the cache from an xml file.
virtual bool isClosed () const
 Indicates if this cache has been closed.
void preserveSB () const
 Atomically increment reference count.
virtual void readyForEvents ()
 Send the "client ready" message to the server from a durable client.
int32_t refCount ()
 
Returns:
the reference count

void releaseSB () const
 Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.
virtual void rootRegions (VectorOfRegion &regions)
 Returns a set of root regions in the cache.
virtual ~Cache ()


Constructor & Destructor Documentation

virtual gemfire::Cache::~Cache (  )  [virtual]

destructor


Member Function Documentation

virtual void gemfire::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:
keepalive whether to keep a durable client's queue alive
Exceptions:
CacheClosedException,if the cache is already closed.

virtual void gemfire::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,if the cache is already closed.

Implements gemfire::RegionService.

virtual RegionServicePtr gemfire::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:
UnsupportedOperationException when invoked with multiuser-authentication as false.
Parameters:
userSecurityProperties the security properties of a user.
poolName the pool that the users should be authenticated against. Set if there are more than one Pool in Cache.

virtual RegionPtr gemfire::Cache::createRegion ( const char *  name,
const RegionAttributesPtr aRegionAttributes 
) [virtual]

Returns a region created using the specified RegionAttributes.

The region is just created locally. It is not created on the server to which this client is connected with.

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 AuthenticatedCache to do the operation on Cache.

Parameters:
name the name of the region to create
aRegionAttributes the attributes of the root region
Returns:
pointer to the returned region
Exceptions:
InvalidArgumentException if the attributePtr is NULLPTR.
RegionExistsException if a region is already in this cache
CacheClosedException if the cache is closed
OutOfMemoryException if the memory allocation failed
InitFailedException if the PersistenceManagerImpl object fails to initialize
UnsupportedOperationException if the region attributes are not consistent with cache attributes and distributed system properties.
UnknownException otherwise
Deprecated:
as of NativeClient 3.5, use Cache#createRegionFactory instead.

virtual RegionFactoryPtr gemfire::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:
regionShortcut To create the region specific type,
See also:
RegionShortcut

virtual DistributedSystemPtr gemfire::Cache::getDistributedSystem (  )  const [virtual]

Returns the distributed system that this cache was created with.

Implements gemfire::GemFireCache.

virtual const char* gemfire::Cache::getName (  )  const [virtual]

Returns the name of this cache.

Returns:
the string name of this cache

Implements gemfire::GemFireCache.

virtual bool gemfire::Cache::getPdxIgnoreUnreadFields (  )  [virtual]

Returns whther Cache saves unread fields for Pdx types.

Currently c++ don't support pdx types, thus it is for internal purpose only

Implements gemfire::GemFireCache.

virtual bool gemfire::Cache::getPdxReadSerialized (  )  [virtual]

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

Currently c++ don't support pdx types, thus it is for internal purpose only

virtual QueryServicePtr gemfire::Cache::getQueryService ( const char *  poolName  )  [virtual]

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

Parameters:
poolName Pass poolname if pool is created from cache.xml or PoolManager
Returns:
A smart pointer to the QueryService.

virtual QueryServicePtr gemfire::Cache::getQueryService (  )  [virtual]

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

Returns:
A smart pointer to the QueryService.

Implements gemfire::RegionService.

virtual RegionPtr gemfire::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:
path the region's name, such as AuthRegion.
Returns:
region, or NULLPTR if no such region exists.

Implements gemfire::RegionService.

virtual void gemfire::Cache::initializeDeclarativeCache ( const char *  cacheXml  )  [virtual]

Initializes the cache from an xml file.

Parameters:
cacheXml Valid cache.xml file

Implements gemfire::GemFireCache.

virtual bool gemfire::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 gemfire::RegionService.

void gemfire::SharedBase::preserveSB (  )  const [inherited]

Atomically increment reference count.

virtual void gemfire::Cache::readyForEvents (  )  [virtual]

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

int32_t gemfire::SharedBase::refCount (  )  [inline, inherited]

Returns:
the reference count

void gemfire::SharedBase::releaseSB (  )  const [inherited]

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

virtual void gemfire::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:
regions the returned set of regions

Implements gemfire::RegionService.


GemFire C++ Cache API Documentation