gemfire::AttributesFactory Class Reference

Inherits gemfire::SharedBase.


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

Distribution

Scope [default: Scope.DISTRIBUTED_NO_ACK]
The C++ cache can contain either local regions or distributed regions. Distributed regions are configured with servers that they distribute their operations to upto. Locally scoped regions do not have any distribution behavior. GFE native client regions scoped as Scope.DISTRIBUTED_NO_ACK and Scope.DISTRIBUTED_ACK have identical distribution behavior.
setScope RegionAttributes#getScope

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)


Public Member Functions

 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.
 AttributesFactory ()
RegionAttributesPtr createRegionAttributes ()
 Creates a RegionAttributes with the current settings.
void preserveSB () const
 Atomically increment reference count.
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.
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.
void setCacheListener (const CacheListenerPtr &aListener)
 Sets the CacheListener for the next RegionAttributes created.
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.
void setCacheLoader (const CacheLoaderPtr &cacheLoader)
 Sets the cache loader for the next RegionAttributes created.
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.
void setCacheWriter (const CacheWriterPtr &cacheWriter)
 Sets the cache writer for the next RegionAttributes created.
void setCachingEnabled (bool cachingEnabled)
 Set caching enabled flag for this region.
void setClientNotificationEnabled (bool clientNotificationEnabled)
 Sets whether client notification is enabled for the next RegionAttributes created.
void setConcurrencyLevel (uint8_t concurrencyLevel)
 Sets the concurrency level tof the next RegionAttributes created.
void setDiskPolicy (const DiskPolicyType::PolicyType diskPolicy)
 Sets the Disk policy type for the next RegionAttributes created.
void setEndpoints (const char *endpoints)
 Sets the endpoints for a thin client's connections to a Java server.
void setEntryIdleTimeout (ExpirationAction::Action action, int32_t idleTimeout)
 Sets the idleTimeout expiration attributes for region entries for the next RegionAttributes created.
void setEntryTimeToLive (ExpirationAction::Action action, int32_t timeToLive)
 Sets the timeToLive expiration attributes for region entries for the next RegionAttributes created.
void setInitialCapacity (int initialCapacity)
 Sets the entry initial capacity for the next RegionAttributes created.
void setLoadFactor (float loadFactor)
 Sets the entry load factor for the next RegionAttributes created.
void setLruEntriesLimit (const uint32_t entriesLimit)
 Sets a limit on the number of entries that will be held in the cache.
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.
void setPartitionResolver (const PartitionResolverPtr &aResolver)
 Sets the PartitionResolver for the next RegionAttributes created.
void setPersistenceManager (const char *libpath, const char *factoryFuncName, const PropertiesPtr &config=gemfire::NullSharedBase::s_instancePtr)
 Sets the library path for the library that will be invoked for the persistence of the region.
void setRegionIdleTimeout (ExpirationAction::Action action, int32_t idleTimeout)
 Sets the idleTimeout expiration attributes for the region itself for the next RegionAttributes created.
void setRegionTimeToLive (ExpirationAction::Action action, int32_t timeToLive)
 Sets the timeToLive expiration attributes for the region itself for the next RegionAttributes created.
void setScope (const ScopeType::Scope scopeType)
 Sets the scope for the next RegionAttributes created.
virtual ~AttributesFactory ()

Constructor & Destructor Documentation

gemfire::AttributesFactory::AttributesFactory (  ) 

public methods constructor Creates a new instance of AttributesFactory ready to create a RegionAttributes with default settings.

gemfire::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:
regionAttributes the RegionAttributes used to initialize this AttributesFactory

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

destructor


Member Function Documentation

RegionAttributesPtr gemfire::AttributesFactory::createRegionAttributes (  ) 

Creates a RegionAttributes with the current settings.

Returns:
the newly created RegionAttributes
Exceptions:
IllegalStateException if the current settings violate the compatibility rules

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

Atomically increment reference count.

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.

void gemfire::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 gemfire::AttributesFactory::setCacheListener ( const CacheListenerPtr aListener  ) 

Sets the CacheListener for the next RegionAttributes created.

Parameters:
aListener a user defined CacheListener, NULLPTR if no listener

void gemfire::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 gemfire::AttributesFactory::setCacheLoader ( const CacheLoaderPtr cacheLoader  ) 

Sets the cache loader for the next RegionAttributes created.

Parameters:
cacheLoader the cache loader or NULLPTR if no loader

void gemfire::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 gemfire::AttributesFactory::setCacheWriter ( const CacheWriterPtr cacheWriter  ) 

Sets the cache writer for the next RegionAttributes created.

Parameters:
cacheWriter the cache writer or NULLPTR if no cache writer

void gemfire::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', 'false' is illegal for regions of 'local' scope. This also requires that interestLists are turned off for the region.

Parameters:
cachingEnabled if true, cache data for this region in this process.

void gemfire::AttributesFactory::setClientNotificationEnabled ( bool  clientNotificationEnabled  ) 

Sets whether client notification is enabled for the next RegionAttributes created.

Parameters:
clientNotificationEnabled whether to use client notification for the region
Deprecated:
since 3.5, use PoolFactory#setSubscriptionEnabled instead.

void gemfire::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:
concurrencyLevel the concurrency level of the entry map
Exceptions:
IllegalArgumentException if concurrencyLevel is nonpositive

void gemfire::AttributesFactory::setDiskPolicy ( const DiskPolicyType::PolicyType  diskPolicy  ) 

Sets the Disk policy type for the next RegionAttributes created.

Parameters:
diskPolicy the type of disk policy to use for the region
Exceptions:
IllegalArgumentException if diskPolicyType is Invalid

void gemfire::AttributesFactory::setEndpoints ( const char *  endpoints  ) 

Sets the endpoints for a thin client's connections to a Java server.

If this attribute is set, this is a thin client region.

Parameters:
endpoints the list of endpoints in the format java_servername1:java_port1,java_servername2:java_port2
Deprecated:
since 3.5, use PoolFactory#addServer or PoolFactory#addLocatorinstead.

void gemfire::AttributesFactory::setEntryIdleTimeout ( ExpirationAction::Action  action,
int32_t  idleTimeout 
)

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

Parameters:
action the expiration action for entries in this region.
idleTimeout the idleTimeout in seconds for entries in this region.

void gemfire::AttributesFactory::setEntryTimeToLive ( ExpirationAction::Action  action,
int32_t  timeToLive 
)

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

Parameters:
action the expiration action for entries in this region.
timeToLive the timeToLive in seconds for entries in this region.

void gemfire::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:
initialCapacity the initial capacity of the entry map
Exceptions:
IllegalArgumentException if initialCapacity is negative.

void gemfire::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:
loadFactor the load factor of the entry map
Exceptions:
IllegalArgumentException if loadFactor is nonpositive

void gemfire::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 gemfire::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 gemfire::AttributesFactory::setPartitionResolver ( const PartitionResolverPtr aResolver  ) 

Sets the PartitionResolver for the next RegionAttributes created.

Parameters:
aResolver a user defined PartitionResolver, NULLPTR if no resolver

void gemfire::AttributesFactory::setPersistenceManager ( const char *  libpath,
const char *  factoryFuncName,
const PropertiesPtr config = gemfire::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 gemfire::AttributesFactory::setRegionIdleTimeout ( ExpirationAction::Action  action,
int32_t  idleTimeout 
)

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

Parameters:
action the expiration action for entries in this region.
idleTimeout the idleTimeout in seconds for the region as a whole.

void gemfire::AttributesFactory::setRegionTimeToLive ( ExpirationAction::Action  action,
int32_t  timeToLive 
)

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

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

void gemfire::AttributesFactory::setScope ( const ScopeType::Scope  scopeType  ) 

Sets the scope for the next RegionAttributes created.

Parameters:
scopeType the type of Scope to use for the region
Exceptions:
IllegalArgumentException if scopeType is Invalid
Deprecated:
since 3.5


GemFire C++ Cache API Documentation