CacheClientConnectivityChangedListener

CacheClientConnectivityChangedListener

Defines a callback method for notifying applications when the Cache Client Connectivity is changed


Constructor

# new CacheClientConnectivityChangedListener(callback)

Parameters:
Name Type Description
callback function

callback is called when the Cache Client Connectivity is changed

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

function myConnectivityCallback() {
  //...
}

//Initialize the Cache Cluster 
let cache = await ncache.CacheManager.getCache("demoCache");

let notificationService = await ncache.cache.getNotificationService();

//Cache Connectivity Changed Listener 
let cacheConnectivity = new ncache.CacheClientConnectivityChangedListener(myConnectivityCallback)
await notificationService.addCacheConnectivityChangedListener(cacheConnectivity);