DataSourceModifiedListener

DataSourceModifiedListener

Defines a callback method for notifying applications when the data source is modified.


Constructor

# new DataSourceModifiedListener(callback)

Parameters:
Name Type Description
callback function

callback is called when the data source is modified.

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

function myDataSourceModifiedCallBack(key, result) {
     //...
}

let writeThruOptions = new ncache.WriteThruOptions(ncache.WriteMode.WriteThru, "Writer");

//Register data modification listener
let datasourceModified = new ncache.DataSourceModifiedListener(myDataSourceModifiedCallBack);
await writeThruOptions.setDataSourceModificationListener(datasourceModified, [ncache.EventType.ItemAdded]);