Skip to content

xuezier/redis-scheduled

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

REDIS-SCHEDULED

NPM version

Support

redis version must be more than 2.8.0 to support key event subscribe

Installation

npm install redis-scheduled --save

Usage

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);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published