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

Creates instances of RegionAttributes. More...

Inherits apache::geode::client::SharedBase.

Public Member Functions

 AttributesFactory ()
 public methods More...
 
 AttributesFactory (const RegionAttributesPtr &regionAttributes)
 Creates a new instance of AttributesFactory ready to create a RegionAttributes with the same settings as those in the specified RegionAttributes. More...
 
RegionAttributesPtr createRegionAttributes ()
 Creates a RegionAttributes with the current settings. More...
 
void preserveSB () const
 Atomically increment reference count. 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...
 
void setCacheListener (const CacheListenerPtr &aListener)
 Sets the CacheListener for the next RegionAttributes created. More...
 
void setCacheListener (const char *libpath, const char *factoryFuncName)
 Sets the library path for the library that will be invoked for the listener of the region. More...
 
void setCacheLoader (const CacheLoaderPtr &cacheLoader)
 Sets the cache loader for the next RegionAttributes created. More...
 
void setCacheLoader (const char *libpath, const char *factoryFuncName)
 Sets the library path for the library that will be invoked for the loader of the region. More...
 
void setCacheWriter (const CacheWriterPtr &cacheWriter)
 Sets the cache writer for the next RegionAttributes created. More...
 
void setCacheWriter (const char *libpath, const char *factoryFuncName)
 Sets the library path for the library that will be invoked for the writer of the region. More...
 
void setCachingEnabled (bool cachingEnabled)
 Set caching enabled flag for this region. More...
 
void setCloningEnabled (bool isClonable)
 Sets cloning on region. More...
 
void setConcurrencyChecksEnabled (bool concurrencyChecksEnabled)
 Enables or disables concurrent modification checks. More...
 
void setConcurrencyLevel (uint8_t concurrencyLevel)
 Sets the concurrency level tof the next RegionAttributes created. More...
 
void setDiskPolicy (const DiskPolicyType::PolicyType diskPolicy)
 Sets the Disk policy type for the next RegionAttributes created. More...
 
void setEntryIdleTimeout (ExpirationAction::Action action, int32_t idleTimeout)
 Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created. More...
 
void setEntryTimeToLive (ExpirationAction::Action action, int32_t timeToLive)
 Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created. More...
 
void setInitialCapacity (int initialCapacity)
 Sets the entry initial capacity for the next RegionAttributes created. More...
 
void setLoadFactor (float loadFactor)
 Sets the entry load factor for the next RegionAttributes created. More...
 
void setLruEntriesLimit (const uint32_t entriesLimit)
 Sets a limit on the number of entries that will be held in the cache. More...
 
void setPartitionResolver (const PartitionResolverPtr &aResolver)
 Sets the PartitionResolver for the next RegionAttributes created. More...
 
void setPartitionResolver (const char *libpath, const char *factoryFuncName)
 Sets the library path for the library that will be invoked for the partition resolver of the region. More...
 
void setPersistenceManager (const char *libpath, const char *factoryFuncName, const PropertiesPtr &config=::apache::geode::client::NullSharedBase::s_instancePtr)
 Sets the library path for the library that will be invoked for the persistence of the region. More...
 
void setPersistenceManager (const PersistenceManagerPtr &persistenceManager, const PropertiesPtr &config=::apache::geode::client::NullSharedBase::s_instancePtr)
 Sets the PersistenceManager for the next RegionAttributes created. More...
 
void setPoolName (const char *name)
 Sets the pool name attribute. More...
 
void setRegionIdleTimeout (ExpirationAction::Action action, int32_t idleTimeout)
 Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes created. More...
 
void setRegionTimeToLive (ExpirationAction::Action action, int32_t timeToLive)
 Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created. More...
 
virtual ~AttributesFactory ()
 destructor More...
 

Detailed Description

Creates instances of RegionAttributes.

An AttributesFactory instance maintains state for creating RegionAttributes instances. The setter methods are used to change the settings that will be used for creating the next attributes instance with the createRegionAttributes method. If you create a factory with the default constructor, then the factory is set up to create attributes with all default settings. You can also create a factory by providing a RegionAttributes, which will set up the new factory with the settings provided in that attributes instance.

Once a RegionAttributes is created, it can only be modified after it has been used to create a Region, and then only by using an AttributesMutator obtained from the region.

Attributes

Callbacks

CacheLoader [default: NULLPTR]

User-implemented plug-in for loading data on cache misses.
setCacheLoader RegionAttributes#getCacheLoader AttributesMutator#setCacheLoader

CacheWriter [default: NULLPTR]

User-implemented plug-in for intercepting cache modifications, e.g. for writing to an external data source.
setCacheWriter RegionAttributes#getCacheWriter AttributesMutator#setCacheWriter

CacheListener [default: NULLPTR]
User-implemented plug-in for receiving and handling cache related events.
setCacheListener RegionAttributes#getCacheListener AttributesMutator#setCacheListener

Expiration

RegionTimeToLive [default: no expiration]

Expiration configuration for the entire region based on the lastModifiedTime.
setRegionTimeToLive RegionAttributes#getRegionTimeToLive AttributesMutator#setRegionTimeToLive

RegionIdleTimeout [default: no expiration]

Expiration configuration for the entire region based on the lastAccessedTime.
setRegionIdleTimeout RegionAttributes#getRegionIdleTimeout AttributesMutator#setRegionIdleTimeout

EntryTimeToLive [default: no expiration]

Expiration configuration for individual entries based on the lastModifiedTime.
setEntryTimeToLive RegionAttributes#getEntryTimeToLive AttributesMutator#setEntryTimeToLive

EntryIdleTimeout [default: no expiration]
Expiration configuration for individual entries based on the lastAccessedTime.
setEntryIdleTimeout RegionAttributes#getEntryIdleTimeout AttributesMutator#setEntryIdleTimeout

Storage

InitialCapacity [default: 16]

The initial capacity of the map used for storing the entries.
RegionAttributes#getInitialCapacity

LoadFactor [default: 0.75]

The load factor of the map used for storing the entries.
RegionAttributes#getLoadFactor

ConcurrencyLevel [default: 16]

The allowed concurrency among updates to values in the region is guided by the concurrencyLevel, which is used as a hint for internal sizing. The actual concurrency will vary. Ideally, you should choose a value to accommodate as many threads as will ever concurrently modify values in the region. Using a significantly higher value than you need can waste space and time, and a significantly lower value can lead to thread contention. But overestimates and underestimates within an order of magnitude do not usually have much noticeable impact. A value of one is appropriate when it is known that only one thread will modify and all others will only read.
setConcurrencyLevel RegionAttributes#getConcurrencyLevel

StatisticsEnabled [default: false]

Whether statistics are enabled for this region. The default is disabled, which conserves on memory.
setStatisticsEnabled RegionAttributes#getStatisticsEnabled

See also
RegionAttributes
AttributesMutator
Region::createSubregion(String, RegionAttributes)

Constructor & Destructor Documentation

apache::geode::client::AttributesFactory::AttributesFactory ( )

public methods

constructorCreates a new instance of AttributesFactory ready to create a RegionAttributes with default settings.

apache::geode::client::AttributesFactory::AttributesFactory ( const RegionAttributesPtr regionAttributes)

Creates a new instance of AttributesFactory ready to create a RegionAttributes with the same settings as those in the specified RegionAttributes.

Parameters
regionAttributesthe RegionAttributes used to initialize this AttributesFactory
virtual apache::geode::client::AttributesFactory::~AttributesFactory ( )
virtual

destructor

Member Function Documentation

RegionAttributesPtr apache::geode::client::AttributesFactory::createRegionAttributes ( )

Creates a RegionAttributes with the current settings.

Returns
the newly created RegionAttributes
Exceptions
IllegalStateExceptionif the current settings violate the compatibility rules
void apache::geode::client::SharedBase::preserveSB ( ) const
inherited

Atomically increment reference count.

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.

void apache::geode::client::AttributesFactory::setCacheListener ( const CacheListenerPtr aListener)

Sets the CacheListener for the next RegionAttributes created.

Parameters
aListenera user defined CacheListener, NULLPTR if no listener
void apache::geode::client::AttributesFactory::setCacheListener ( const char *  libpath,
const char *  factoryFuncName 
)

Sets the library path for the library that will be invoked for the listener of the region.

void apache::geode::client::AttributesFactory::setCacheLoader ( const CacheLoaderPtr cacheLoader)

Sets the cache loader for the next RegionAttributes created.

Parameters
cacheLoaderthe cache loader or NULLPTR if no loader
void apache::geode::client::AttributesFactory::setCacheLoader ( const char *  libpath,
const char *  factoryFuncName 
)

Sets the library path for the library that will be invoked for the loader of the region.

void apache::geode::client::AttributesFactory::setCacheWriter ( const CacheWriterPtr cacheWriter)

Sets the cache writer for the next RegionAttributes created.

Parameters
cacheWriterthe cache writer or NULLPTR if no cache writer
void apache::geode::client::AttributesFactory::setCacheWriter ( const char *  libpath,
const char *  factoryFuncName 
)

Sets the library path for the library that will be invoked for the writer of the region.

void apache::geode::client::AttributesFactory::setCachingEnabled ( bool  cachingEnabled)

Set caching enabled flag for this region.

If set to false, then no data is stored in the local process, but events and distributions will still occur, and the region can still be used to put and remove, etc... The default if not set is 'true'. This also requires that interestLists are turned off for the region.

Parameters
cachingEnabledif true, cache data for this region in this process.
void apache::geode::client::AttributesFactory::setCloningEnabled ( bool  isClonable)

Sets cloning on region.

Parameters
isClonable
See also
RegionAttributes::getCloningEnabled()
void apache::geode::client::AttributesFactory::setConcurrencyChecksEnabled ( bool  concurrencyChecksEnabled)

Enables or disables concurrent modification checks.

Since
7.0
Parameters
concurrencyChecksEnabledwhether to perform concurrency checks on operations
void apache::geode::client::AttributesFactory::setConcurrencyLevel ( uint8_t  concurrencyLevel)

Sets the concurrency level tof the next RegionAttributes created.

This value is used in initializing the map that holds the entries.

Parameters
concurrencyLevelthe concurrency level of the entry map
Exceptions
IllegalArgumentExceptionif concurrencyLevel is nonpositive
void apache::geode::client::AttributesFactory::setDiskPolicy ( const DiskPolicyType::PolicyType  diskPolicy)

Sets the Disk policy type for the next RegionAttributes created.

Parameters
diskPolicythe type of disk policy to use for the region
Exceptions
IllegalArgumentExceptionif diskPolicyType is Invalid
void apache::geode::client::AttributesFactory::setEntryIdleTimeout ( ExpirationAction::Action  action,
int32_t  idleTimeout 
)

Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created.

Parameters
actionthe expiration action for entries in this region.
idleTimeoutthe idleTimeout in seconds for entries in this region.
void apache::geode::client::AttributesFactory::setEntryTimeToLive ( ExpirationAction::Action  action,
int32_t  timeToLive 
)

Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created.

Parameters
actionthe expiration action for entries in this region.
timeToLivethe timeToLive in seconds for entries in this region.
void apache::geode::client::AttributesFactory::setInitialCapacity ( int  initialCapacity)

Sets the entry initial capacity for the next RegionAttributes created.

This value is used in initializing the map that holds the entries.

Parameters
initialCapacitythe initial capacity of the entry map
Exceptions
IllegalArgumentExceptionif initialCapacity is negative.
void apache::geode::client::AttributesFactory::setLoadFactor ( float  loadFactor)

Sets the entry load factor for the next RegionAttributes created.

This value is used in initializing the map that holds the entries.

Parameters
loadFactorthe load factor of the entry map
Exceptions
IllegalArgumentExceptionif loadFactor is nonpositive
void apache::geode::client::AttributesFactory::setLruEntriesLimit ( const uint32_t  entriesLimit)

Sets a limit on the number of entries that will be held in the cache.

If a new entry is added while at the limit, the cache will evict the least recently used entry. Defaults to 0, meaning no LRU actions will used.

void apache::geode::client::AttributesFactory::setPartitionResolver ( const PartitionResolverPtr aResolver)

Sets the PartitionResolver for the next RegionAttributes created.

Parameters
aResolvera user defined PartitionResolver, NULLPTR if no resolver
void apache::geode::client::AttributesFactory::setPartitionResolver ( const char *  libpath,
const char *  factoryFuncName 
)

Sets the library path for the library that will be invoked for the partition resolver of the region.

void apache::geode::client::AttributesFactory::setPersistenceManager ( const char *  libpath,
const char *  factoryFuncName,
const PropertiesPtr config = ::apache::geode::client::NullSharedBase::s_instancePtr 
)

Sets the library path for the library that will be invoked for the persistence of the region.

If the region is being created from a client on a server, or on a server directly, then this must be used to set the PersistenceManager.

void apache::geode::client::AttributesFactory::setPersistenceManager ( const PersistenceManagerPtr persistenceManager,
const PropertiesPtr config = ::apache::geode::client::NullSharedBase::s_instancePtr 
)

Sets the PersistenceManager for the next RegionAttributes created.

Parameters
persistenceManagera user defined PersistenceManager, NULLPTR if no resolver
void apache::geode::client::AttributesFactory::setPoolName ( const char *  name)

Sets the pool name attribute.

This causes regions that use these attributes to be a client region which communicates with the servers that the connection pool communicates with.

If this attribute is set to null or "" then the connection pool is disabled causing regions that use these attributes to be communicate with peers instead of servers.

The named connection pool must exist on the cache at the time these attributes are used to create a region. See PoolManager#createFactory for how to create a connection pool.

Parameters
namethe name of the connection pool to use; if null or "" then the connection pool is disabled for regions using these attributes.
void apache::geode::client::AttributesFactory::setRegionIdleTimeout ( ExpirationAction::Action  action,
int32_t  idleTimeout 
)

Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes created.

Parameters
actionthe expiration action for entries in this region.
idleTimeoutthe idleTimeout in seconds for the region as a whole.
void apache::geode::client::AttributesFactory::setRegionTimeToLive ( ExpirationAction::Action  action,
int32_t  timeToLive 
)

Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created.

Parameters
actionthe expiration action for entries in this region.
timeToLivethe timeToLive in seconds for the region as a whole.

Pivotal GemFire C++ Cache API Documentation