VMware Tanzu GemFire Native C++ Reference 10.3.0
apache::geode::client::RegionAttributesFactory Class Reference

Creates instances of RegionAttributes. More...

#include <RegionAttributesFactory.hpp>

Public Member Functions

RegionAttributes create ()
 Creates a RegionAttributes with the current settings. More...
 
 RegionAttributesFactory ()
 public methods More...
 
 RegionAttributesFactory (const RegionAttributes regionAttributes)
 Creates a new instance of RegionAttributesFactory ready to create a RegionAttributes with the same settings as those in the specified RegionAttributes. More...
 
RegionAttributesFactorysetCacheListener (const std::shared_ptr< CacheListener > &aListener)
 Sets the CacheListener for the next RegionAttributes created. More...
 
RegionAttributesFactorysetCacheListener (const std::string &libpath, const std::string &factoryFuncName)
 Sets the library path for the library that will be invoked for the listener of the region. More...
 
RegionAttributesFactorysetCacheLoader (const std::shared_ptr< CacheLoader > &cacheLoader)
 Sets the cache loader for the next RegionAttributes created. More...
 
RegionAttributesFactorysetCacheLoader (const std::string &libpath, const std::string &factoryFuncName)
 Sets the library path for the library that will be invoked for the loader of the region. More...
 
RegionAttributesFactorysetCacheWriter (const std::shared_ptr< CacheWriter > &cacheWriter)
 Sets the cache writer for the next RegionAttributes created. More...
 
RegionAttributesFactorysetCacheWriter (const std::string &libpath, const std::string &factoryFuncName)
 Sets the library path for the library that will be invoked for the writer of the region. More...
 
RegionAttributesFactorysetCachingEnabled (bool cachingEnabled)
 Set caching enabled flag for this region. More...
 
RegionAttributesFactorysetCloningEnabled (bool isClonable)
 Sets cloning on region. More...
 
RegionAttributesFactorysetConcurrencyChecksEnabled (bool concurrencyChecksEnabled)
 Enables or disables concurrent modification checks. More...
 
RegionAttributesFactorysetConcurrencyLevel (uint8_t concurrencyLevel)
 Sets the concurrency level tof the next RegionAttributes created. More...
 
RegionAttributesFactorysetDiskPolicy (const DiskPolicyType diskPolicy)
 Sets the Disk policy type for the next RegionAttributes created. More...
 
RegionAttributesFactorysetEntryIdleTimeout (ExpirationAction action, std::chrono::seconds idleTimeout)
 Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created. More...
 
RegionAttributesFactorysetEntryTimeToLive (ExpirationAction action, std::chrono::seconds timeToLive)
 Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created. More...
 
RegionAttributesFactorysetInitialCapacity (int32_t initialCapacity)
 Sets the entry initial capacity for the next RegionAttributes created. More...
 
RegionAttributesFactorysetLoadFactor (float loadFactor)
 Sets the entry load factor for the next RegionAttributes created. More...
 
RegionAttributesFactorysetLruEntriesLimit (const uint32_t entriesLimit)
 Sets a limit on the number of entries that will be held in the cache. More...
 
RegionAttributesFactorysetPartitionResolver (const std::shared_ptr< PartitionResolver > &aResolver)
 Sets the PartitionResolver for the next RegionAttributes created. More...
 
RegionAttributesFactorysetPartitionResolver (const std::string &libpath, const std::string &factoryFuncName)
 Sets the library path for the library that will be invoked for the partition resolver of the region. More...
 
RegionAttributesFactorysetPersistenceManager (const std::shared_ptr< PersistenceManager > &persistenceManager, const std::shared_ptr< Properties > &config=nullptr)
 Sets the PersistenceManager for the next RegionAttributes created. More...
 
RegionAttributesFactorysetPersistenceManager (const std::string &libpath, const std::string &factoryFuncName, const std::shared_ptr< Properties > &config=nullptr)
 Sets the library path for the library that will be invoked for the persistence of the region. More...
 
RegionAttributesFactorysetPoolName (const std::string &name)
 Sets the pool name attribute. More...
 
RegionAttributesFactorysetRegionIdleTimeout (ExpirationAction action, std::chrono::seconds idleTimeout)
 Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes created. More...
 
RegionAttributesFactorysetRegionTimeToLive (ExpirationAction action, std::chrono::seconds timeToLive)
 Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created. More...
 
virtual ~RegionAttributesFactory ()
 destructor More...
 

Detailed Description

Creates instances of RegionAttributes.

An RegionAttributesFactory 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 create 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

◆ RegionAttributesFactory() [1/2]

apache::geode::client::RegionAttributesFactory::RegionAttributesFactory ( )

public methods

constructor Creates a new instance of RegionAttributesFactory ready to create a RegionAttributes with default settings.

◆ RegionAttributesFactory() [2/2]

apache::geode::client::RegionAttributesFactory::RegionAttributesFactory ( const RegionAttributes  regionAttributes)
explicit

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

Parameters
regionAttributesthe RegionAttributes used to initialize this RegionAttributesFactory

◆ ~RegionAttributesFactory()

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

destructor

Member Function Documentation

◆ create()

RegionAttributes apache::geode::client::RegionAttributesFactory::create ( )

Creates a RegionAttributes with the current settings.

Returns
the newly created RegionAttributes
Exceptions
IllegalStateExceptionif the current settings violate the compatibility rules
Returns
a reference to this

◆ setCacheListener() [1/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setCacheListener ( const std::shared_ptr< CacheListener > &  aListener)

Sets the CacheListener for the next RegionAttributes created.

Parameters
aListenera user defined CacheListener, nullptr if no listener
Returns
a reference to this

◆ setCacheListener() [2/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setCacheListener ( const std::string &  libpath,
const std::string &  factoryFuncName 
)

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

Returns
a reference to this

◆ setCacheLoader() [1/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setCacheLoader ( const std::shared_ptr< CacheLoader > &  cacheLoader)

Sets the cache loader for the next RegionAttributes created.

Parameters
cacheLoaderthe cache loader or nullptr if no loader
Returns
a reference to this

◆ setCacheLoader() [2/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setCacheLoader ( const std::string &  libpath,
const std::string &  factoryFuncName 
)

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

Returns
a reference to this

◆ setCacheWriter() [1/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setCacheWriter ( const std::shared_ptr< CacheWriter > &  cacheWriter)

Sets the cache writer for the next RegionAttributes created.

Parameters
cacheWriterthe cache writer or nullptr if no cache writer
Returns
a reference to this

◆ setCacheWriter() [2/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setCacheWriter ( const std::string &  libpath,
const std::string &  factoryFuncName 
)

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

Returns
a reference to this

◆ setCachingEnabled()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::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.
Returns
a reference to this

◆ setCloningEnabled()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setCloningEnabled ( bool  isClonable)

Sets cloning on region.

Parameters
isClonablewhether region is clonable or not
Returns
a reference to this
See also
RegionAttributes::getCloningEnabled()

◆ setConcurrencyChecksEnabled()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setConcurrencyChecksEnabled ( bool  concurrencyChecksEnabled)

Enables or disables concurrent modification checks.

Since
7.0
Parameters
concurrencyChecksEnabledwhether to perform concurrency checks on operations
Returns
a reference to this

◆ setConcurrencyLevel()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::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
Returns
a reference to this
Exceptions
IllegalArgumentExceptionif concurrencyLevel is nonpositive

◆ setDiskPolicy()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setDiskPolicy ( const DiskPolicyType  diskPolicy)

Sets the Disk policy type for the next RegionAttributes created.

Parameters
diskPolicythe type of disk policy to use for the region
Returns
a reference to this
Exceptions
IllegalArgumentExceptionif diskPolicyType is Invalid

◆ setEntryIdleTimeout()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setEntryIdleTimeout ( ExpirationAction  action,
std::chrono::seconds  idleTimeout 
)

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

Will expire in no less than idleTimeout. Actual time may be longer depending on clock resolution.

Parameters
actionthe expiration action for entries in this region.
idleTimeoutthe idleTimeout for entries in this region.
Returns
a reference to this

◆ setEntryTimeToLive()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setEntryTimeToLive ( ExpirationAction  action,
std::chrono::seconds  timeToLive 
)

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

Will expire in no less than timeToLive, actual time may be longer depending on clock resolution.

Parameters
actionthe expiration action for entries in this region.
timeToLivethe timeToLive for entries in this region.
Returns
a reference to this

◆ setInitialCapacity()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setInitialCapacity ( int32_t  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
Returns
a reference to this
Exceptions
IllegalArgumentExceptionif initialCapacity is negative.

◆ setLoadFactor()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::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
Returns
a reference to this
Exceptions
IllegalArgumentExceptionif loadFactor is nonpositive

◆ setLruEntriesLimit()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::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.

Returns
a reference to this

◆ setPartitionResolver() [1/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setPartitionResolver ( const std::shared_ptr< PartitionResolver > &  aResolver)

Sets the PartitionResolver for the next RegionAttributes created.

Parameters
aResolvera user defined PartitionResolver, nullptr if no resolver
Returns
a reference to this

◆ setPartitionResolver() [2/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setPartitionResolver ( const std::string &  libpath,
const std::string &  factoryFuncName 
)

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

Returns
a reference to this

◆ setPersistenceManager() [1/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setPersistenceManager ( const std::shared_ptr< PersistenceManager > &  persistenceManager,
const std::shared_ptr< Properties > &  config = nullptr 
)

Sets the PersistenceManager for the next RegionAttributes created.

Parameters
persistenceManagera user defined PersistenceManager, nullptr if no resolver
Returns
a reference to this

◆ setPersistenceManager() [2/2]

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setPersistenceManager ( const std::string &  libpath,
const std::string &  factoryFuncName,
const std::shared_ptr< Properties > &  config = nullptr 
)

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.

Returns
a reference to this

◆ setPoolName()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setPoolName ( const std::string &  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.

Returns
a reference to this
Parameters
namethe name of the connection pool to use; if null or "" then the connection pool is disabled for regions using these attributes.

◆ setRegionIdleTimeout()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setRegionIdleTimeout ( ExpirationAction  action,
std::chrono::seconds  idleTimeout 
)

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

Will expire in no less than idleTimeout, actual time may be longer depending on clock resolution.

Parameters
actionthe expiration action for entries in this region.
idleTimeoutthe idleTimeout for the region as a whole.
Returns
a reference to this

◆ setRegionTimeToLive()

RegionAttributesFactory & apache::geode::client::RegionAttributesFactory::setRegionTimeToLive ( ExpirationAction  action,
std::chrono::seconds  timeToLive 
)

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

Will expire in no less than timeToLive, actual time may be longer depending on clock resolution.

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

Apache Geode C++ Cache API Documentation