GemStone::GemFire::Cache::Generic::CacheFactory Class Reference

Inherits GemStone::GemFire::Cache::Generic::Internal::SBWrap< gemfire::CacheFactory >.


Detailed Description

A factory class that must be used to obtain instance of Cache.

To create a new cache instance, use CacheFactory.CreateCacheFactory.

To get an existing unclosed cache instance, use CacheFactory.GetInstance.

Public Member Functions

CacheFactoryAddLocator (String^ host, Int32 port)
CacheFactoryAddServer (String^ host, Int32 port)
CacheCreate ()
CacheFactorySet (String^ name, String^ value)
CacheFactorySetFreeConnectionTimeout (Int32 connectionTimeout)
CacheFactorySetIdleTimeout (Int32 idleTimeout)
CacheFactorySetLoadConditioningInterval (Int32 loadConditioningInterval)
CacheFactorySetMaxConnections (Int32 maxConnections)
CacheFactorySetMinConnections (Int32 minConnections)
CacheFactorySetMultiuserAuthentication (bool multiuserAuthentication)
CacheFactorySetPdxIgnoreUnreadFields (bool ignore)
 Control whether pdx ignores fields that were unread during deserialization.
CacheFactorySetPdxReadSerialized (bool pdxReadSerialized)
 Sets the object preference to PdxInstance type.
CacheFactorySetPingInterval (Int32 pingInterval)
CacheFactorySetPRSingleHopEnabled (Boolean enabled)
CacheFactorySetReadTimeout (Int32 timeout)
CacheFactorySetRetryAttempts (Int32 retryAttempts)
CacheFactorySetServerGroup (String^ group)
CacheFactorySetSocketBufferSize (Int32 bufferSize)
CacheFactorySetStatisticInterval (Int32 statisticInterval)
CacheFactorySetSubscriptionAckInterval (Int32 ackInterval)
CacheFactorySetSubscriptionEnabled (Boolean enabled)
CacheFactorySetSubscriptionMessageTrackingTimeout (Int32 messageTrackingTimeout)
CacheFactorySetSubscriptionRedundancy (Int32 redundancy)
CacheFactorySetThreadLocalConnections (bool enabled)
CacheFactorySetUpdateLocatorListInterval (Int32 updateLocatorListInterval)

Static Public Member Functions

static CacheCreate (String^ name, DistributedSystem^ system, String^ cacheXml, CacheAttributes^ attributes)
static CacheCreate (String^ name, DistributedSystem^ system, CacheAttributes^ attributes)
static CacheCreate (String^ name, DistributedSystem^ system, String^ cacheXml)
static CacheCreate (String^ name, DistributedSystem^ system)
static CacheFactoryCreateCacheFactory ()
static CacheFactoryCreateCacheFactory (Properties< String^ , String^ >^dsProps)
static CacheGetAnyInstance ()
static CacheGetInstance (DistributedSystem^ system)
static CacheGetInstanceCloseOk (DistributedSystem^ system)
static void SetNewAndDelete ()

Protected Member Functions

void _SetNativePtr (gemfire::CacheFactory *nativeptr)
void AssignPtr (gemfire::CacheFactory *nativeptr)
void InternalCleanup ()
void SetPtr (gemfire::CacheFactory *nativeptr)

Properties

static String^  ProductDescription [get]
static String^  Version [get]


Member Function Documentation

void GemStone::GemFire::Cache::Generic::Internal::SBWrap< gemfire::CacheFactory >::_SetNativePtr ( gemfire::CacheFactory *  nativeptr  )  [inline, protected, inherited]

Set the native pointer to the new object without doing a preserveSB(). DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING.

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::AddLocator ( String^   host,
Int32  port 
)

Add a locator, given its host and port, to this factory.

The locator must be a server locator and will be used to discover other running bridge servers and locators.

host the host name or ip address that the locator is listening on.

port the port that the locator is listening on

throws IllegalArgumentException if host is an unknown host or if port is outside the valid range of [1..65535] inclusive.

throws IllegalStateException if a locator has already been added to this factory.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::AddServer ( String^   host,
Int32  port 
)

Add a server, given its host and port, to this factory.

The server must be a bridge server and this client will directly connect to without consulting a server locator.

host the host name or ip address that the server is listening on.

port the port that the server is listening on

throws IllegalArgumentException if host is an unknown host or if port is outside the valid range of [1..65535] inclusive.

throws IllegalStateException if a server has already been added to this factory.

Returns:
a instance of CacheFactory

void GemStone::GemFire::Cache::Generic::Internal::SBWrap< gemfire::CacheFactory >::AssignPtr ( gemfire::CacheFactory *  nativeptr  )  [inline, protected, inherited]

Used to assign the native pointer to a new object.

Note the order of preserveSB() and releaseSB(). This handles the corner case when m_nativeptr is same as nativeptr.

static Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::Create ( String^   name,
DistributedSystem^   system,
String^   cacheXml,
CacheAttributes^   attributes 
) [static]

Creates a new cache using the specified system using parameters from the given XML file and with the given CacheAttributes.

Parameters:
name the name to associate with the new cache
system a DistributedSystem obtained by calling DistributedSystem.Connect
cacheXml name of the cache configuration XML file
attributes optional CacheAttributes for this cache; these override the ones provided in cacheXml.
Returns:
a Cache that uses the specified DistributedSystem for distribution.
Exceptions:
IllegalArgumentException If system is not DistributedSystem.IsConnected or name is null
CacheExistsException ff an open cache already exists
CacheXmlException if something went wrong while parsing the XML
IllegalStateException if the XML file is well-formed but not valid (consistent)
<deprecated> as of NativeClient 3.5, use CacheFactory.CreateCacheFactory instead. </deprecated>

static Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::Create ( String^   name,
DistributedSystem^   system,
CacheAttributes^   attributes 
) [static]

Creates a new cache using the specified system using the given CacheAttributes.

Parameters:
name the name to associate with the new cache
system a DistributedSystem obtained by calling DistributedSystem.Connect
attributes optional CacheAttributes for this cache
Returns:
a Cache that uses the specified DistributedSystem for distribution.
Exceptions:
IllegalArgumentException If system is not DistributedSystem.IsConnected or name is null
CacheExistsException ff an open cache already exists
<deprecated> as of NativeClient 3.5, use CacheFactory.CreateCacheFactory instead. </deprecated>

static Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::Create ( String^   name,
DistributedSystem^   system,
String^   cacheXml 
) [static]

Creates a new cache using the specified system using parameters from the given XML file.

Parameters:
name the name to associate with the new cache
system a DistributedSystem obtained by calling DistributedSystem.Connect
cacheXml name of the cache configuration XML file
Returns:
a Cache that uses the specified DistributedSystem for distribution.
Exceptions:
IllegalArgumentException If system is not DistributedSystem.IsConnected or name is null
CacheExistsException ff an open cache already exists
CacheXmlException if something went wrong while parsing the XML
IllegalStateException if the XML file is well-formed but not valid (consistent)
<deprecated> as of NativeClient 3.5, use CacheFactory.CreateCacheFactory instead. </deprecated>

static Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::Create ( String^   name,
DistributedSystem^   system 
) [static]

Creates a new cache using the specified system.

Parameters:
name the name to associate with the new cache
system a DistributedSystem obtained by calling DistributedSystem.Connect
Returns:
a Cache that uses the specified DistributedSystem for distribution.
Exceptions:
IllegalArgumentException If system is not connected ( DistributedSystem.IsConnected ) or name is null.
CacheExistsException If an open cache already exists.
<deprecated> as of NativeClient 3.5, use CacheFactory.CreateCacheFactory instead. </deprecated>

Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::Create (  ) 

To create the instance of Cache.

static CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::CreateCacheFactory (  )  [static]

A factory class that must be used to obtain instance of Cache. This should be called once. Using this one can set default values of Pool.

static CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::CreateCacheFactory ( Properties< String^ , String^ >^  dsProps  )  [static]

A factory class that must be used to obtain instance of Cache. This should be called once. Using this one can set default values of Pool.

Parameters:
dsProps Properties which are applicable at client level.

static Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::GetAnyInstance (  )  [static]

Gets an arbitrary open instance of Cache produced by an earlier call to CacheFactory.Create.

Exceptions:
CacheClosedException if a cache has not been created or the only created one is closed ( Cache.IsClosed )
EntryNotFoundException if a cache with specified system not found

static Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::GetInstance ( DistributedSystem^   system  )  [static]

Gets the instance of Cache produced by an earlier call to CacheFactory.Create.

Parameters:
system the DistributedSystem the cache was created with.
Returns:
the Cache associated with the specified system.
Exceptions:
IllegalArgumentException if the distributed system argument is null
CacheClosedException if a cache has not been created or the created one is closed ( Cache.IsClosed )
EntryNotFoundException if a cache with specified system not found

static Cache ^ GemStone::GemFire::Cache::Generic::CacheFactory::GetInstanceCloseOk ( DistributedSystem^   system  )  [static]

Gets the instance of Cache produced by an earlier call to CacheFactory.Create, even if it has been closed.

Parameters:
system the DistributedSystem the cache was created with.
Returns:
the Cache associated with the specified system.
Exceptions:
IllegalArgumentException if the distributed system argument is null
CacheClosedException if a cache has not been created.
EntryNotFoundException if a cache with specified system not found

void GemStone::GemFire::Cache::Generic::Internal::SBWrap< gemfire::CacheFactory >::InternalCleanup (  )  [inline, protected, inherited]

Internal cleanup function invoked by dispose/finalizer.

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::Set ( String^   name,
String^   value 
)

Sets a gemfire property that will be used when creating the ClientCache. name the name of the gemfire property

value the value of the gemfire property

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetFreeConnectionTimeout ( Int32  connectionTimeout  ) 

Sets the free connection timeout for this pool.

If the pool has a max connections setting, operations will block if all of the connections are in use. The free connection timeout specifies how long those operations will block waiting for a free connection before receiving an AllConnectionsInUseException. If max connections is not set this setting has no effect. connectionTimeout the connection timeout in milliseconds

IllegalArgumentException if connectionTimeout is less than or equal to 0.

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetIdleTimeout ( Int32  idleTimeout  ) 

Set the amount of time a connection can be idle before expiring the connection.

If the pool size is greater than the minimum specified, connections which have been idle for longer than the idleTimeout will be closed.

idleTimeout The amount of time in milliseconds that an idle connection should live before expiring. -1 indicates that connections should never expire.

throws IllegalArgumentException if idleTimout is less than 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetLoadConditioningInterval ( Int32  loadConditioningInterval  ) 

Sets the load conditioning interval for this pool.

This interval controls how frequently the pool will check to see if a connection to a given server should be moved to a different server to improve the load balance.

loadConditioningInterval the connection lifetime in milliseconds A value of -1 disables load conditioning.

throws IllegalArgumentException if connectionLifetime is less than -1.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetMaxConnections ( Int32  maxConnections  ) 

Set the max number of client to server connections that the pool will create.

If all of the connections are in use, an operation requiring a client to server connection will block until a connection is available. see setFreeConnectionTimeout(int)

maxConnections the maximum number of connections in the pool. -1 indicates that there is no maximum number of connections.

throws IllegalArgumentException if maxConnections is less than minConnections.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetMinConnections ( Int32  minConnections  ) 

Set the minimum number of connections to keep available at all times.

When the pool is created, it will create this many connections. If 0 then connections will not be made until an actual operation is done that requires client-to-server communication.

minConnections the initial number of connections this pool will create.

throws IllegalArgumentException if minConnections is less than 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetMultiuserAuthentication ( bool  multiuserAuthentication  ) 

Sets whether pool is in multiuser mode

multiuserAuthentication should be true/false. Default value is false;

Returns:
a instance of CacheFactory
summary>

static void GemStone::GemFire::Cache::Generic::CacheFactory::SetNewAndDelete (  )  [inline, static]

Set allocators for non default Microsoft CRT versions.

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetPdxIgnoreUnreadFields ( bool  ignore  ) 

Control whether pdx ignores fields that were unread during deserialization.

The default is to preserve unread fields be including their data during serialization. But if you configure the cache to ignore unread fields then their data will be lost during serialization.

You should only set this attribute to true if you know this member will only be reading cache data. In this use case you do not need to pay the cost of preserving the unread fields since you will never be reserializing pdx data. summary> ignore true if fields not read during pdx deserialization should be ignored; false, the default, if they should be preserved.

Returns:
a instance of CacheFactory
summary>

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetPdxReadSerialized ( bool  pdxReadSerialized  ) 

Sets the object preference to PdxInstance type.

When a cached object that was serialized as a PDX is read from the cache a PdxInstance will be returned instead of the actual domain class. The PdxInstance is an interface that provides run time access to the fields of a PDX without deserializing the entire PDX. The PdxInstance implementation is a light weight wrapper that simply refers to the raw bytes of the PDX that are kept in the cache. Using this method applications can choose to access PdxInstance instead of Java object. Note that a PdxInstance is only returned if a serialized PDX is found in the cache. If the cache contains a deserialized PDX, then a domain class instance is returned instead of a PdxInstance. /summary> pdxReadSerialized true to prefer PdxInstance false, the default, if they should be preserved.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetPingInterval ( Int32  pingInterval  ) 

Set how often to ping servers to verify that they are still alive.

Each server will be sent a ping every pingInterval if there has not been any other communication with the server. These pings are used by the server to monitor the health of the client. Make sure that the pingInterval is less than the maximum time between pings allowed by the bridge server. see in CacheServer: setMaximumTimeBetweenPings(int)

pingInterval The amount of time in milliseconds between pings.

throws IllegalArgumentException if pingInterval is less than 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetPRSingleHopEnabled ( Boolean  enabled  ) 

By default SetPRSingleHopEnabled is true.

The client is aware of location of partitions on servers hosting Using this information, the client routes the client cache operations directly to the server which is hosting the required partition for the cache operation. If SetPRSingleHopEnabled is false the client can do an extra hop on servers to go to the required partition for that cache operation. The SetPRSingleHopEnabled avoids extra hops only for following cache operations : put, get & destroy operations.

Returns:
a instance of CacheFactory

void GemStone::GemFire::Cache::Generic::Internal::SBWrap< gemfire::CacheFactory >::SetPtr ( gemfire::CacheFactory *  nativeptr  )  [inline, protected, inherited]

Used to set the native pointer to a new object. This should only be used when you know that the underlying object is NULL.

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetReadTimeout ( Int32  timeout  ) 

Sets the number of milliseconds to wait for a response from a server before timing out the operation and trying another server (if any are available).

timeout number of milliseconds to wait for a response from a server

throws IllegalArgumentException if timeout is less than or equal to 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetRetryAttempts ( Int32  retryAttempts  ) 

Set the number of times to retry a request after timeout/exception.

retryAttempts The number of times to retry a request after timeout/exception. -1 indicates that a request should be tried against every available server before failing.

throws IllegalArgumentException if idleTimout is less than 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetServerGroup ( String^   group  ) 

Configures the group that all servers this pool connects to must belong to.

group the server group that this pool will connect to. If null or "" then all servers will be connected to.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetSocketBufferSize ( Int32  bufferSize  ) 

Sets the socket buffer size for each connection made in this pool.

Large messages can be received and sent faster when this buffer is larger. Larger buffers also optimize the rate at which servers can send events for client subscriptions.

bufferSize the size of the socket buffers used for reading and writing on each connection in this pool.

throws IllegalArgumentException if bufferSize is less than or equal to 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetStatisticInterval ( Int32  statisticInterval  ) 

Set how often to send client statistics to the server.

Doing this allows gfmon to monitor clients. A value of -1 disables the sending of client statistics to the server. statisticInterval The amount of time in milliseconds between sends of client statistics to the server.

throws IllegalArgumentException if statisticInterval is less than -1.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetSubscriptionAckInterval ( Int32  ackInterval  ) 

Sets the is the interval in milliseconds to wait before sending acknowledgements to the bridge server for events received from the server subscriptions.

ackInterval number of milliseconds to wait before sending event acknowledgements.

throws IllegalArgumentException if ackInterval is less than or equal to 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetSubscriptionEnabled ( Boolean  enabled  ) 

Enable subscriptions.

If set to true then the created pool will have server-to-client subscriptions enabled. If set to false then all Subscription* attributes are ignored at create time.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetSubscriptionMessageTrackingTimeout ( Int32  messageTrackingTimeout  ) 

Sets the messageTrackingTimeout attribute which is the time-to-live period, in milliseconds, for subscription events the client has received from the server.

It's used to minimize duplicate events. Entries that have not been modified for this amount of time are expired from the list.

messageTrackingTimeout number of milliseconds to set the timeout to.

throws IllegalArgumentException if messageTrackingTimeout is less than or equal to 0.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetSubscriptionRedundancy ( Int32  redundancy  ) 

Sets the redundancy level for this pools server-to-client subscriptions.

If 0 then no redundant copies will be kept on the servers. Otherwise an effort will be made to maintain the requested number of copies of the server-to-client subscriptions. At most one copy per server will be made up to the requested level.

redundancy the number of redundant servers for this client's subscriptions.

throws IllegalArgumentException if redundancyLevel is less than -1.

Returns:
a instance of CacheFactory

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetThreadLocalConnections ( bool  enabled  ) 

Enable thread local connections.

Sets the thread local connections policy for the default connection pool. If true then any time a thread goes to use a connection from this pool it will check a thread local cache and see if it already has a connection in it. If so it will use it. If not it will get one from this pool and cache it in the thread local. This gets rid of thread contention for the connections but increases the number of connections the servers see. If false then connections are returned to the pool as soon as the operation being done with the connection completes. This allows connections to be shared amonst multiple threads keeping the number of connections down.

CacheFactory ^ GemStone::GemFire::Cache::Generic::CacheFactory::SetUpdateLocatorListInterval ( Int32  updateLocatorListInterval  ) 

Set how often to update locator list from locator

updateLocatorListInterval The amount of time in milliseconds between updating locator list. If its set to 0 then client will not update the locator list.

Returns:
a instance of CacheFactory


Property Documentation

String^ GemStone::GemFire::Cache::Generic::CacheFactory::ProductDescription [static, get]

Returns the product description string including product name and version.

String^ GemStone::GemFire::Cache::Generic::CacheFactory::Version [static, get]

Returns the version of the cache implementation. For the 1.0 release of GemFire, the string returned is 1.0.

Returns:
the version of the cache implementation as a String


GemFire C++ Cache .NET API Documentation