Scheduled purge/prefetch tasks can be triggered through SCF. Such tasks are included in the daily purge/prefetch quota and may fail to be executed if the quota is exceeded.
Log in to the CDN console, select Plugin Center on the sidebar, click the scheduled purge/prefetch plugin feature block, and enable scheduled purge/prefetch to enter the task configuration page. After this feature is enabled, you can also click Basic Configuration at the bottom of the block to enter the scheduled purge/prefetch task list page for configuration.
On the Create Scheduled Task page, select the desired task type, set the cron scheduling expression (see the example below), enter the corresponding purge/prefetch URLs, and perform SCF authorization. Then, the system can automatically generate the corresponding SCF function and trigger the task as scheduled.
Do not delete this function in the SCF console.
On the task status page, you can view the last execution of the scheduled task.
A cron expression contains seven values separated by spaces.
|1||Second||An integer between 0 and 59||, - * /|
|2||Minute||An integer between 0 and 59||, - * /|
|3||Hour||An integer between 0 and 23||, - * /|
|4||Day||An integer between 1 and 31 (the number of days in the month needs to be considered)||, - * /|
|5||Month||An integer between 1 and 12 or JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, or DEC||, - * /|
|6||Day of week||An integer between 0 and 6 or MON, TUE, WED, THU, FRI, SAT, or SUN, where 0 means Monday, 1 means Tuesday, and so on||, - * /|
|7||Year||An integer between 1970–2099||, - * /|
Wildcards have the following meanings:
|, (comma)||It represents the union of characters separated by commas; for example, 1, 2, 3 in the "Hour" field means 1:00, 2:00 and 3:00|
|- (hyphen)||It contains all values in the specified range; for example, in the "Day" field, 1-15 contains the 1st to the 15th day of the specified month|
|* (asterisk)||It means all values; for example, in the "Hour" field, * means every o'clock|
|/ (forward slash)||It specifies the increment; for example, in the "Minute" field, you can enter 1/10 to specify repeating every ten minutes from the first minute on (e.g., at the 11th minute, the 21st minute, the 31st minute, and so on)|
When both the "Day" and "Week" fields in a cron expression are specified, they are in an "or" relationship, i.e., the conditions of both are effective separately.
33 22 11 6 7 * 2021means triggering the task at 11:22:33 on July 6, 2021.
00 00 20 25 10 * 2021means triggering the task at 20:00:00 on October 25, 2021.
*/5 * * * * * *means triggering the task once every 5 seconds.
0 0 2 1 * * *means triggering the task once at 2 AM on the 1st day of every month.
0 15 10 * * MON-FRI *means triggering the task once every day at 10:15 AM Monday through Friday.
0 0 10,14,16 * * * *means triggering the task once every day at 10 AM, 2 PM, and 4 PM.
0 */30 9-17 * * * *means triggering the task once every half hour from 9 AM to 5 PM every day.
0 0 12 * * WED *means triggering the task once at 12:00 noon every Wednesday.
The scheduled purge/prefetch feature is free of charge. However, it will call SCF to create scheduled tasks, which may incur SCF fees if the free tier of SCF is exceeded. For more information, see Free Tier.