redis version must be more than 2.8.0 to support key event subscribe
npm install redis-scheduled --save
var scheduled = require('redis-scheduled')({ db:1, prefix: 'scheduled' });
create repeat scheduled
scheduled.every({ from: '2016/11/21 10:21:30', repeat: '30min', name: 'myTask'}, callback);
/**
* from timestamp, like 'yyyy/MM/dd [hh:mm:ss]', 'yyyy-MM-dd [hh:mm:ss]', msTime
* repeat unit: s, min, h, day, week
* name scheduled name
*
* scheduled will run every repeat time after from(include from time)
*/
destory repeat scheduled
scheduled.clearEvery(name);
create scheduled task
scheduled.setTimeout(name, '2016/11/21 10:21:30', callback);
/**
* scheduled only run once
*/
destory scheduled task
scheduled.clearTimeout(name);