CacheStatusEventListener

CacheStatusEventListener

Cluster Listener listens for the events related to the Clsuter. like memberJoined, memberLeft events.


Constructor

# new CacheStatusEventListener(callback)

Parameters:
Name Type Description
callback function

method that will be called when notification is recieved

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

function myCacheStatusEventListener() {
 //...
}

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

//Create Cache Status Event Listener
 let listener = new ncache.CacheStatusEventListener(myCacheStatusEventListener);
 await notificationService.addCacheStatusEventListener(listener, ncache.CacheStatusNotificationType.CacheStopped);