Constructor
# new DataStructureDataChangeListener(callback)
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | callback is called when the dataStructure is modified |
Example
const ncache = require('ncache-client');
function onDataStructureChanged(collectionName, collectionEventArgs) {
//...
}
//Initialize the Cache Cluster
let cache = await ncache.CacheManager.getCache("demoCache");
//Get DataStructure Manager
let _typeManager= await cache.getDataStructuresManager();
//Create Distributed Queue
let queue =await _typeManager.createQueue("DistributedQueue",ncache.JsonDataType.Scaler);
//Register data change listener
let listener = new ncache.DataStructureDataChangeListener(onDataStructureChanged);
queue.addChangeListener(listener, [ncache.EventType.ItemAdded, ncache.EventType.ItemRemoved], ncache.DataTypeEventDataFilter.Data);