async-task-mgr
Intro
A simple nodeJS module for async task manager. Identical tasks will be executed only once and the result will be saved for further use.
Features
- tasks with the same name are identified as the same, and will be executed only once
- task result will be saved for further use
How to use
npm install async-task-mgr --save
Sample
var asyncTask = ; var asyncTaskInstance = ; { ; } //add a new task named task_A//when taskAction is done, its return value will be saved and apply to all the task with the same nameasyncTaskInstance; //add a new task named task_A/*since a task with the same name has been added, this taskAction will not be executed.the callback function will be put in a queue and will be called when previous callbacks are done.*/asyncTaskInstance; //add a new task named task_X//a new task, have no relationship to the previous onesasyncTaskInstance;
Author
Otto Mao ottomao@gmail.com