CacheConnectionOptions

CacheConnectionOptions

Instance of this class can be used to define the parameters at the time of client connection with the cache.


Constructor

# new CacheConnectionOptions()

Example
const ncache  = require('ncache-client');

let connectionOptions = new ncache.CacheConnectionOptions();
connectionOptions.setLoadBalance(true);
connectionOptions.setConnectionRetries(5);
connectionOptions.setIsolationLevel(ncache.IsolationLevel.OutProc);
connectionOptions.setServerList(new Array().push(new ncache.ServerInfo("remoteServer", "20.200.20.10",9800)));

//Initialize the Cache Cluster 
let cache = await ncache.CacheManager.getCache("test-Cache", connectionOptions);

Methods

# getAppName() → {string}

Gets the appication name.If different client applications are connected to server and because of any issue which results in connection failure with server, after the client again establishes connection AppName is used to identify these different client applications.

Returns:
Type
string

# getClientBindIP() → {string}

Gets the IP for the client to be binded with

Returns:
Type
string

# getClientCacheMode() → {number}

Gets ClientCacheSyncMode to specify how the Client cache is synchronized with the cluster caches through events.

Returns:
Type
number

# getClientRequestTimeOut() → {TimeSpan}

Gets client request timeOut interval

Returns:
Type
TimeSpan

# getCommandRetries() → {number}

Get Command retries.

Returns:
Type
number

# getCommandRetryInterval() → {TimeSpan}

Gets command retry interval

Returns:
Type
TimeSpan

# getConnectionRetries() → {number}

Gets number of retry connections

Returns:
Type
number

# getConnectionTimeout() → {TimeSpan}

Get connection timeout interval

Returns:
Type
TimeSpan

# getDefaultReadThruProvider() → {string}

Get ID of DefaultReadThruProvider

Returns:
Type
string

# getDefaultWriteThruProvider() → {string}

Gets ID of DefaultWriteThruProvider

Returns:
Type
string

# getEnableClientLogs() → {boolean}

Get client logs Flag.

Returns:
Type
boolean

# getEnableKeepAlive() → {boolean}

Gets the keep alive flag.

Returns:
Type
boolean

# getIsolationMode() → {number}

Gets the IsolationLevel of the cache.

Returns:
Type
number

# getKeepAliveInterval() → {TimeSpan}

Gets Sets the KeepAliveInterval

Returns:
Type
TimeSpan

# getLoadBalance() → {boolean}

Get Value of LoadBalance Flag

Returns:
Type
boolean

# getLogLevel() → {LogLevel}

Gets the LogLevel either as Info, Error or Debug.

Returns:
Type
LogLevel

# getRetryConnectionDelay() → {TimeSpan}

gets retry connection delay interval

Returns:
Type
TimeSpan

# getRetryInterval() → {TimeSpan}

Gets time in seconds to wait between two connection retries.

Returns:
Type
TimeSpan

# getRetryL1ConnectionInterval() → {number}

Returns:
Type
number

# getSecondaryUserCredentials() → {Credentials}

Returns:
Type
Credentials

# getServerList() → {Array.<ServerInfo>}

Get List of Alachisoft.NCache.Client.ServerInfo in the cache.

Returns:
Type
Array.<ServerInfo>

# getUserCredentials() → {Credentials}

Gets Credentials for the authentication of connection with the cache. This information is required when the security is enabled.

Returns:
Type
Credentials

# isSkipUnAvailableClientCache() → {boolean}

Returns:

Skip clientcahe if not available.

Type
boolean

# setAppName(value)

If different client applications are connected to server and because of any issue which results in connection failure with server, after the client again establishes connection “AppName” is used to identify these different client applications.

Parameters:
Name Type Description
value string

Application's name

# setClientBindIP(value)

Sets the IP for the client to be binded with

Parameters:
Name Type Description
value string

Sets the IP for the client to be binded with

# setClientCacheMode(clientCacheSyncMode)

Sets ClientCacheSyncMode to specify how the Client cache is synchronized with the cluster caches through events.

Parameters:
Name Type Description
clientCacheSyncMode number

Sets ClientCacheSyncMode to specify how the Client cache is synchronized with the cluster caches through events.

# setClientRequestTimeOut(value)

Clients operation timeout specified in seconds. Clients wait for the response from the server for this time. If the response is not received within this time, the operation is not successful. Based on the network conditions, OperationTimeout value can be adjusted. The default value is 90 seconds.

Parameters:
Name Type Description
value TimeSpan

Based on the network conditions, OperationTimeout value can be adjusted. The default value is 90 seconds.

# setCommandRetries(value)

Set command retries, If client application sends request to server for any operation and a response is not received, then the number of retries it will make until it gets response is defined here.

Parameters:
Name Type Description
value number

number of retries it will make until it gets response is defined here.

# setCommandRetryInterval(value)

Sets command retry interval, In case if client app doesn’t get response against some operation call on server, the command retry interval defines the waiting period before the next attempt to send the operation the server is made. Type integer which defines seconds.

Parameters:
Name Type Description
value TimeSpan

defines seconds

# setConnectionRetries(value)

If client application sends request to server for any operation and a response is not received, then the number of retries it will make until it gets response is defined here.

Parameters:
Name Type Description
value number

Number of tries to re-establish a broken connection between client and server.

# setConnectionTimeout(value)

Set Client's connection timeout specified in seconds

Parameters:
Name Type Description
value TimeSpan

Client's connection timeout specified in seconds.

# setDefaultReadThruProvider(value)

Sets ID of DefaultReadThruProvider

Parameters:
Name Type Description
value string

Sets ID of DefaultReadThruProvider

# setDefaultWriteThruProvider(value)

Sets ID of DefaultWriteThruProvider

Parameters:
Name Type Description
value string

Sets ID of DefaultWriteThruProvider

# setEnableClientLogs(value)

Enables client logs.

Parameters:
Name Type Description
value boolean

Enables client logs.

# setEnableKeepAlive(value)

Sets the keep alive flag.

Parameters:
Name Type Description
value boolean

Sets the keep alive flag.

# setIsolationLevel(isolationLevel)

Sets the IsolationLevel of the cache.

Parameters:
Name Type Description
isolationLevel number

Sets the IsolationLevel of the cache.

# setKeepAliveInterval(value)

Sets the KeepAliveInterval, which will be in effect if the EnabledKeepAlive is set 'true' or is specified 'true' from the client configuration. Note: If the value to be set is lesser than 1 or is greater than 7200 (2 hours in seconds), it will resort back 30 seconds internally.

Parameters:
Name Type Description
value TimeSpan

Sets the KeepAliveInterval, which will be in effect if the EnabledKeepAlive is set 'true' or is specified 'true' from the client configuration.

# setLoadBalance(value)

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.

Parameters:
Name Type Description
value boolean

This way almost equal number of clients are connected to every node in the clustered cache and no single node is overburdened.

# setLogLevel(value)

Sets the LogLevel either as Info, Error or Debug.

Parameters:
Name Type Description
value number

Sets the LogLevel either as Info, Error or Debug.

# setRetryConnectionDelay(value)

Set the time after which client will try to reconnect to the server.

Parameters:
Name Type Description
value TimeSpan

The time after which client will try to reconnect to the server.

# setRetryInterval(value)

Sets time in seconds to wait between two connection retries.

Parameters:
Name Type Description
value TimeSpan

Time in seconds to wait between two connection retries.

# setRetryL1ConnectionInterval(value)

Parameters:
Name Type Description
value number

indicates value for RetryL1ConnectionInterval

# setServerList(listOfServerInfo)

Set List of Alachisoft.NCache.Client.ServerInfo in the cache.

Parameters:
Name Type Description
listOfServerInfo Array.<ServerInfo>

List of ServerInfo in the cache.

# setSkipUnAvailableClientCache(skipUnAvailableClientCache)

Parameters:
Name Type Description
skipUnAvailableClientCache boolean

indicates value for skipUnAvailableClientCache

# setUserCredentials(value)

Sets Credentials for the authentication of connection with the cache. This information is required when the security is enabled.

Parameters:
Name Type Description
value Credentials

Sets Credentials for the authentication of connection with the cache.