Class CacheConnectionOptions
Instance of this class can be used to define the parameters at the time of client connection with the cache.
Inheritance
Assembly: Alachisoft.NCache.Client.dll
Syntax
public class CacheConnectionOptions
Examples
The following example demonstrates how to use CacheConnectionOptions to get instance of ICache from CacheManager.
CacheConnectionOptions cacheConnectionOptions = new CacheConnectionOptions();
cacheConnectionOptions.LoadBalance = true;
cacheConnectionOptions.ConnectionRetries = 5;
cacheConnectionOptions.Mode = IsolationLevel.OutProc;
cacheConnectionOptions.ClientRequestTimeOut = TimeSpan.FromSeconds(30);
cacheConnectionOptions.UserCredentials = new Credentials("domain\\user-id", "password");
cacheConnectionOptions.RetryInterval = TimeSpan.FromSeconds(5);
cacheConnectionOptions.ServerList = new List<ServerInfo>()
{
new ServerInfo("remoteServer", 9800)
};
ICache cache = CacheManager.GetCache("demoCache", cacheConnectionOptions);
Properties
Name | Description |
---|---|
AppName | If different client applications are connected to server and because of any issue, which results in connection failure with server, after the client reestablishes connection, AppName is used to identify these different client applications. Data type is string. Its optional. If value is not set it takes the value of the process id. |
ClientBindIP | Gets/Sets the IP for the client to be binded with. |
ClientCacheMode | Gets/Sets ClientCacheSyncMode to specify how the client cache is synchronized with the cluster caches through events. |
ClientRequestTimeOut | It specifies the client operation timeout in seconds. Clients wait for the response from the server for this specified time. If the response is not received within this specified time, the operation is not successful. Based on the network conditions, OperationTimeout value can be adjusted. The default value is 90 seconds. |
CommandRetries | Command Retries will specify the number of retries necessary to receive a response. By default, CommandRetries is set to 3 retries. |
CommandRetryInterval | In case, the client application does not get any response against some command from the server, the command retry interval defines the waiting period before the next attempt to send the command. |
ConnectionRetries | Number of tries to reestablish a broken connection between the client and a server. By default, ConnectionRetries is set to 3 retries. |
ConnectionTimeout | Client's connection timeout specified in seconds. |
DefaultReadThruProvider | Gets/Sets ID for the default value of the Read-Through Provider. |
DefaultWriteThruProvider | Gets/Sets ID for the default value of the Write-Through Provider. |
EnableClientLogs | A flag indicating whether to enable client logs or not. |
EnableKeepAlive | Sets the keep alive flag. |
KeepAliveInterval | Gets/Sets the KeepAliveInterval, which will be in effect, if the EnabledKeepAlive is set to 'true' or is specified 'true' from the client configuration.
|
LoadBalance | When this flag is set, client tries to connect to the optimum server in terms of number of connected clients. This way almost equal number of clients are connected to every node in the clustered cache and no single node is overburdened. |
LoadBalancerConnectionRetries | This represents how many times the client will prompt the load balancer to get connected to the right machine. This property is used when there is a load balancer between client and server cluster. |
LogLevel | Sets the LogLevel either as Info, Error or Debug. |
Mode | Gets/Sets the IsolationLevel of the cache. |
RetryConnectionDelay | The time after which the client will try to reconnect to the server. |
RetryInterval | The time, in seconds, to wait between two connection retries. |
RetryL1ConnectionInterval | Time in seconds to retry client cache connection. |
ServerList | List of ServerInfo in the cache. |
SkipUnAvailableClientCache | Skip client cache if not available. |
UserCredentials | Gets/Sets Credentials for the authentication of connection with the cache. This information is required when the security is enabled. |
Methods
Name | Description |
---|---|
Clone() | Creates a new object that is a copy of the current instance. |