gemfire::Cache Class Reference

Inherits gemfire::SharedBase.


Detailed Description

Caches are obtained from static methods on the CacheFactory class.

When a cache is created a DistributedSystem must be specified.

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

void close (bool keepalive=false)
 Terminates this object cache and releases all the local resources.
RegionPtr createRegion (const char *name, RegionAttributesPtr &aRegionAttributes)
 Returns a region created using the specified RegionAttributes.
void createServerRegion (const char *name, RegionAttributesPtr &aRegionAttributes)
 This functionality is unsupported in the Native Client Product.
void deregisterRegionListener (CacheRegionListenerPtr &listener)
 Deregister a CacheRegionListener.
void destroyServerRegion (const char *name)
 This functionality is unsupported in the Native Client Product.
void freeStringList (char **names, int cnt)
 This functionality is unsupported in the Native Client Product.
DistributedSystemPtr getDistributedSystem ()
 Returns the distributed system that this cache was created with.
const char * getName () const
 Returns the name of this cache.
QueryServicePtr getQueryService ()
 Gets the QueryService from which a new Query can be obtained.
RegionPtr getRegion (const char *path)
 Look up a region with the full path from root.
RegionAttributesPtr getServerRegionAttributes (const char *path)
 This functionality is unsupported in the Native Client Product.
char ** getServerRegions (const char *parent, int &regionCnt)
 This functionality is unsupported in the Native Client Product.
void initializeDeclarativeCache (const char *cacheXml)
bool isClosed () const
 Indicates if this cache has been closed.
void preserveSB () const
 Atomically increment reference count.
void readyForEvents ()
 Send the "client ready" message to the server from a durable client.
int32_t refCount ()
 
Returns:
the reference count

void registerRegionListener (CacheRegionListenerPtr &listener)
 Register a CacheRegionListener.
void releaseSB () const
 Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.
void rootRegions (VectorOfRegion &regions)
 Returns a set of root regions in the cache.
char ** serverRootRegions (int &rootRegionCnt)
 This functionality is unsupported in the Native Client Product.
void setSearchTimeout (int seconds)
 This functionality is unsupported in the Native Client Product.
virtual ~Cache ()


Constructor & Destructor Documentation

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

destructor


Member Function Documentation

void gemfire::Cache::close ( bool  keepalive = false  ) 

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.

Parameters:
keepalive whether to keep a durable client's queue alive
Exceptions:
CacheClosedException,if the cache is already closed.

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

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.

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 NULL.
RegionExistsException if a region is already in this cache
CacheClosedException if the cache is closed
OutOfMemoryException if the memory allocation failed
RegionCreationFailedException if the call fails due to incomplete mirror initialization
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

void gemfire::Cache::createServerRegion ( const char *  name,
RegionAttributesPtr aRegionAttributes 
)

This functionality is unsupported in the Native Client Product.

void gemfire::Cache::deregisterRegionListener ( CacheRegionListenerPtr listener  ) 

Deregister a CacheRegionListener.

Parameters:
listener the CacheListener deregistered

void gemfire::Cache::destroyServerRegion ( const char *  name  ) 

This functionality is unsupported in the Native Client Product.

void gemfire::Cache::freeStringList ( char **  names,
int  cnt 
)

This functionality is unsupported in the Native Client Product.

DistributedSystemPtr gemfire::Cache::getDistributedSystem (  ) 

Returns the distributed system that this cache was created with.

const char* gemfire::Cache::getName (  )  const

Returns the name of this cache.

Returns:
the string name of this cache

QueryServicePtr gemfire::Cache::getQueryService (  ) 

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

Returns:
A smart pointer to the QueryService.

RegionPtr gemfire::Cache::getRegion ( const char *  path  ) 

Look up a region with the full path from root.

Parameters:
path the region's path, such as RootA/Sub1/Sub1A.
Returns:
region, or NULL if no such region exists.

RegionAttributesPtr gemfire::Cache::getServerRegionAttributes ( const char *  path  ) 

This functionality is unsupported in the Native Client Product.

char** gemfire::Cache::getServerRegions ( const char *  parent,
int &  regionCnt 
)

This functionality is unsupported in the Native Client Product.

void gemfire::Cache::initializeDeclarativeCache ( const char *  cacheXml  ) 

public methods Initializes the cache from an xml file

bool gemfire::Cache::isClosed (  )  const

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

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

Atomically increment reference count.

void gemfire::Cache::readyForEvents (  ) 

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::Cache::registerRegionListener ( CacheRegionListenerPtr listener  ) 

Register a CacheRegionListener.

Parameters:
listener the CacheListener registered

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

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

void gemfire::Cache::rootRegions ( VectorOfRegion regions  ) 

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

char** gemfire::Cache::serverRootRegions ( int &  rootRegionCnt  ) 

This functionality is unsupported in the Native Client Product.

void gemfire::Cache::setSearchTimeout ( int  seconds  ) 

This functionality is unsupported in the Native Client Product.


GemFire C++ Cache API Documentation