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
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.
Declaration
public string AppName { get; set; }
Property Value
Type | Description |
---|---|
System.String | Name of the client application. |
ClientBindIP
Gets/Sets the IP for the client to be binded with.
Declaration
public string ClientBindIP { get; set; }
Property Value
Type | Description |
---|---|
System.String | 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.
Declaration
public ClientCacheSyncMode? ClientCacheMode { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<ClientCacheSyncMode> | Synchronization mode for the client and cluster cache. |
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.
Declaration
public TimeSpan? ClientRequestTimeOut { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | Client operation timeout specified in seconds. |
CommandRetries
Command Retries will specify the number of retries necessary to receive a response. By default, CommandRetries is set to 3 retries.
Declaration
public int? CommandRetries { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | Number of retries made by the client application to get the response. |
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.
Declaration
public TimeSpan? CommandRetryInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | This property specifies the waiting period in seconds before attempting to send the next operation to the server. |
ConnectionRetries
Number of tries to reestablish a broken connection between the client and a server. By default, ConnectionRetries is set to 3 retries.
Declaration
public int? ConnectionRetries { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | Number of tries to reestablish a broken connection between the client and a server. |
ConnectionTimeout
Client's connection timeout specified in seconds.
Declaration
public TimeSpan? ConnectionTimeout { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | This property specifies the client connection in seconds. |
DefaultReadThruProvider
Gets/Sets ID for the default value of the Read-Through Provider.
Declaration
public string DefaultReadThruProvider { get; set; }
Property Value
Type | Description |
---|---|
System.String | ID or the default value of the Read-Through Provider. |
DefaultWriteThruProvider
Gets/Sets ID for the default value of the Write-Through Provider.
Declaration
public string DefaultWriteThruProvider { get; set; }
Property Value
Type | Description |
---|---|
System.String | ID of the for the default value of the Write-Through Provider. |
EnableClientLogs
A flag indicating whether to enable client logs or not.
Declaration
public bool? EnableClientLogs { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> | Specifies a boolean value, either true or false. |
EnableKeepAlive
Sets the keep alive flag.
Declaration
public bool? EnableKeepAlive { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> | Specifies a boolean value, either true or false. |
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.
Declaration
public TimeSpan? KeepAliveInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | The time interval which specifies the KeepAliveInterval in seconds. |
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.
Declaration
public bool? LoadBalance { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> | Specifies a boolean value, either true or false. |
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.
Declaration
public int? LoadBalancerConnectionRetries { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> |
LogLevel
Sets the LogLevel either as Info, Error or Debug.
Declaration
public LogLevel? LogLevel { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<LogLevel> | This property defines the level of logging you want to use. |
Mode
Gets/Sets the IsolationLevel of the cache.
Declaration
public IsolationLevel? Mode { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<IsolationLevel> | This property specifies the Isolation Level of the cache. |
RetryConnectionDelay
The time after which the client will try to reconnect to the server.
Declaration
public TimeSpan? RetryConnectionDelay { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | The time after which the client will try to reconnect to the server. |
RetryInterval
The time, in seconds, to wait between two connection retries.
Declaration
public TimeSpan? RetryInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.TimeSpan> | The time, in seconds, to wait between two connection retries. |
RetryL1ConnectionInterval
Time in seconds to retry client cache connection.
Declaration
public int? RetryL1ConnectionInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Int32> | Number of retries. |
ServerList
List of ServerInfo in the cache.
Declaration
public IList<ServerInfo> ServerList { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IList<ServerInfo> | This property specifies the list of servers along with all the relevant server info. |
SkipUnAvailableClientCache
Skip client cache if not available.
Declaration
public bool? SkipUnAvailableClientCache { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> | Specifies a boolean value, either true or false. |
UserCredentials
Gets/Sets Credentials for the authentication of connection with the cache. This information is required when the security is enabled.
Declaration
public Credentials UserCredentials { get; set; }
Property Value
Type | Description |
---|---|
Credentials | This property provides the security parameters for authorization. |
Methods
Clone()
Creates a new object that is a copy of the current instance.
Declaration
public object Clone()
Returns
Type | Description |
---|---|
System.Object | Object that is a copy of the current instance. |