Redis-based timed task method and redis-based timed task system
A technology for timed tasks and tasks, applied in the direction of program startup/switching, program control design, instruments, etc., can solve the problems of low flexibility and insufficient time control flexibility, and achieve the utilization of system resources, simplification of task setting, and time Highly controllable effect
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0025] The present invention combines redis and mysql to design a timing task trigger method with high flexibility. Such as figure 1 As shown, the present invention provides a redis-based timing task method, and the timing task method is mainly divided into two situations, including a single task and a cyclic task; in the case of a single task, its specific timing task method steps are:
[0026] S11. Input script task path and script task parameters;
[0027] S12. Input the task type, and if the task type at this time is a single task, then input the execution time;
[0028] S13. Generate a globally unique task ID;
[0029] S14. Redis sets the task ID as the KEY value and the expiration time of the KEY;
[0030] S15. Mysql records the task ID, records the script task path and task parameters, and records the execution time; if the task type is a cyclic task, Mysql also needs to record the task execution time interval;
[0031] S16, after the expiry time of KEY expires, Red...
Embodiment 2
[0045] This embodiment provides a redis-based timing task system on the basis of a redis-based timing task method in Embodiment 1, which is characterized in that it includes an input module, a Redis setting module, a Mysql data module, a client, and a loop module ;
[0046] The input module is used to input script task path, script task parameters and task type; the task type includes single task and cyclic task; in the case of cyclic task, the input module is also used to input execution time; In the case of secondary tasks, the input module is also used to input the first execution time and task execution time interval;
[0047] The input module is also used to generate a globally unique task ID;
[0048] The Redis setting module is used to set the task ID as the expiration time of KEY value and KEY; after the expiration time of KEY expires, the Redis setting module is used to notify the client;
[0049] Described Mysql data module is used for recording task ID, script tas...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 

