NCache 4.6 - Online Documentation

Cache Client

Cache Clients are light weight modules through which cache applications can connect to the hosted cache servers.
TCP Based communication: Cache client connects to the cache server using TCP sockets. Cache client opens a persistent connection with the cache server so when it is disconnected due to network failure, it always reconnects with the cache server.
No Change in API: For both local and remote connection, API for cache operations does not change.
Data Serialization: Data that you add needs to be serializable, serialization is performed in cache client.
Data Compression: Compression is configurable, if enabled, serialized data is compressed in cache client.
Data Encryption: Encryption is also configurable, if enabled, data is encrypted after the compression cache client. NCache supports AES and 3DES encryption.
Request Timeout: Timeout for synchronous cache operations like Add/Insert can be configured. This means that if no response is received within configured time, an exception will be thrown. The default operation timeout is 60 seconds. This request timeout should always be higher than the cluster operation timeout.
Cache Server Information: Cache clients require server information in order to establish connection. This cache server information can be provided in two ways, either through CacheInitParams or through client configurations (client.ncconf).
Add/Remove Node: If there is any node addition or removal in the cache cluster, cache client will also add/ remove server information to its server list. In case of a fail over, the client will automatically connect to the newly joined node. 
Fail Over: In case a server goes down, cache client seamlessly establishes a connection with the next available server. If none of the servers are available e.g. due to network failure, cache client keeps on trying to establish connection with the server in the background. When a server becomes available again, it immediately connects to it and the application can resume its activity with the cache. In Partition and Partitioned-Replica cache topology, cache client maintains a connection with every cache server. In case the cache client is unable to connect with some of server(s), it executes cache requests through other available cache servers (resulting in a more than one hop operation). Meanwhile, it keeps trying to establish a connection with the server in background.
Connection Retry interval and Retry Count: When an application executes any cache operation through cache client and no connection is available, the cache client tries to establish the connection. The connection establishment process tries to establish a connection for a configurable number of retries. You can also configure the interval between two consecutive retries. Meanwhile, the application thread waits for a connection establishment. When the number of retries (retry count) are over and the cache client has still been unable to connect to any of the cache servers, the application request is then considered as failed and an exception is thrown to the client application.  
Load balancing: Cache client is topology aware and it behaves according to the topology. In replicated cache cluster, clients are load balanced among cache servers, if any node joins/leaves an existing replicated cluster, the load of clients is reshuffled.
Awareness of data distribution: In Partition and Partition of Replicas, cache client is aware of data distribution and establishes a connection with all cache servers.
Data distribution approach has the following advantages:
1.     Operation is one-hop, which results in a higher throughput.
2.     Cache requests are truly balanced among cache servers and no single server is overwhelmed.
See Also