Constructor
# new CacheConnectionOptions()
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.
- Type
- string
# getClientBindIP() → {string}
Gets the IP for the client to be binded with
- Type
- string
# getClientCacheMode() → {number}
Gets ClientCacheSyncMode to specify how the Client cache is synchronized with the cluster caches through events.
- Type
- number
# getClientRequestTimeOut() → {TimeSpan}
Gets client request timeOut interval
- Type
- TimeSpan
# getCommandRetries() → {number}
Get Command retries.
- Type
- number
# getCommandRetryInterval() → {TimeSpan}
Gets command retry interval
- Type
- TimeSpan
# getConnectionRetries() → {number}
Gets number of retry connections
- Type
- number
# getConnectionTimeout() → {TimeSpan}
Get connection timeout interval
- Type
- TimeSpan
# getDefaultReadThruProvider() → {string}
Get ID of DefaultReadThruProvider
- Type
- string
# getDefaultWriteThruProvider() → {string}
Gets ID of DefaultWriteThruProvider
- Type
- string
# getEnableClientLogs() → {boolean}
Get client logs Flag.
- Type
- boolean
# getEnableKeepAlive() → {boolean}
Gets the keep alive flag.
- Type
- boolean
# getIsolationMode() → {number}
Gets the IsolationLevel of the cache.
- Type
- number
# getKeepAliveInterval() → {TimeSpan}
Gets Sets the KeepAliveInterval
- Type
- TimeSpan
# getLoadBalance() → {boolean}
Get Value of LoadBalance Flag
- Type
- boolean
# getLogLevel() → {LogLevel}
Gets the LogLevel either as Info, Error or Debug.
- Type
- LogLevel
# getRetryConnectionDelay() → {TimeSpan}
gets retry connection delay interval
- Type
- TimeSpan
# getRetryInterval() → {TimeSpan}
Gets time in seconds to wait between two connection retries.
- Type
- TimeSpan
# getRetryL1ConnectionInterval() → {number}
- Type
- number
# getSecondaryUserCredentials() → {Credentials}
- Type
- Credentials
# getServerList() → {Array.<ServerInfo>}
Get List of Alachisoft.NCache.Client.ServerInfo in the cache.
- Type
- Array.<ServerInfo>
# getUserCredentials() → {Credentials}
Gets Credentials for the authentication of connection with the cache. This information is required when the security is enabled.
- Type
- Credentials
# isSkipUnAvailableClientCache() → {boolean}
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.
Name | Type | Description |
---|---|---|
value |
string | Application's name |
# setClientBindIP(value)
Sets the IP for the client to be binded with
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.
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.
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.
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.
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.
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
Name | Type | Description |
---|---|---|
value |
TimeSpan | Client's connection timeout specified in seconds. |
# setDefaultReadThruProvider(value)
Sets ID of DefaultReadThruProvider
Name | Type | Description |
---|---|---|
value |
string | Sets ID of DefaultReadThruProvider |
# setDefaultWriteThruProvider(value)
Sets ID of DefaultWriteThruProvider
Name | Type | Description |
---|---|---|
value |
string | Sets ID of DefaultWriteThruProvider |
# setEnableClientLogs(value)
Enables client logs.
Name | Type | Description |
---|---|---|
value |
boolean | Enables client logs. |
# setEnableKeepAlive(value)
Sets the keep alive flag.
Name | Type | Description |
---|---|---|
value |
boolean | Sets the keep alive flag. |
# setIsolationLevel(isolationLevel)
Sets the IsolationLevel of the cache.
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.
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.
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.
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.
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.
Name | Type | Description |
---|---|---|
value |
TimeSpan | Time in seconds to wait between two connection retries. |
# setRetryL1ConnectionInterval(value)
Name | Type | Description |
---|---|---|
value |
number | indicates value for RetryL1ConnectionInterval |
# setServerList(listOfServerInfo)
Set List of Alachisoft.NCache.Client.ServerInfo in the cache.
Name | Type | Description |
---|---|---|
listOfServerInfo |
Array.<ServerInfo> | List of ServerInfo in the cache. |
# setSkipUnAvailableClientCache(skipUnAvailableClientCache)
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.
Name | Type | Description |
---|---|---|
value |
Credentials | Sets Credentials for the authentication of connection with the cache. |