clear-temp/schedule
URI
http://{server}:{port}/dashboard/web/api/configuration/clear-temp/schedule
支持的方法
GET、POST
父资源
configuration
介绍
定时清理缓存配置资源,用于管理 GIS 云套件 output/temp 目录的定时清理策略。可设置清理的执行时间、执行周期以及清理功能的启用/禁用状态。支持按天、按周、按月三种周期模式。
支持的方法:
- GET:获取当前的定时清理缓存配置信息。
- POST:修改定时清理缓存配置信息。
支持的表述格式:JSON。
HTTP 请求方法
对如下 URI 执行 HTTP 请求,其中,{server}是服务网关的服务器名,需用实际网关 IP 替换;{port}是网关端口,需用实际网关端口替换。
http://{server}:{port}/dashboard/web/api/configuration/clear-temp/schedule
GET 请求
获取当前的定时清理缓存配置信息,包括是否启用、清理时间、周期类型和周期值。
请求参数
GET 请求无请求参数。
响应结构
| 字段 | 类型 | 说明 |
|---|---|---|
| enabled | Boolean | 定时清理缓存功能是否开启。true 表示开启,false 表示关闭。 |
| cycleType | String | 定时清理的周期类型。可选值:day(每天执行)、dayOfWeek(每周执行)、dayOfMonth(每月执行)。 |
| cycleInterval | String | 定时清理的周期值,多个值以英文逗号分隔。当 cycleType 为 dayOfWeek 时,取值为 "1,2,3,4,5,6,7",其中 1 表示周一,7 表示周日;当 cycleType 为 dayOfMonth 时,取值为 "1,20" 等,表示每月指定日期;当 cycleType 为 day 时,该字段可为空。 |
| clearTime | Object | 定时清理的执行时间。 |
| clearTime.hour | Integer | 执行清理的小时,取值范围:0-23。 |
| clearTime.minute | Integer | 执行清理的分钟,取值范围:0-59。 |
响应示例
对 clear-temp/schedule 资源执行 GET 请求,URL:http://192.168.17.139:32507/dashboard/web/api/configuration/clear-temp/schedule,返回的内容如下:
{
"enabled": true,
"cycleType": "dayOfWeek",
"cycleInterval": "1,2,3,4,5,6,7",
"clearTime": {
"hour": 19,
"minute": 30
}
}
以上返回结果表示:定时清理缓存功能已开启,执行周期为每周一至周日(即每天),执行时间为 19:30。
POST 请求
修改定时清理缓存配置信息,包括是否启用、清理时间、周期类型和周期值。配置修改保存后立即生效。
请求头格式
content-type: application/json
请求参数
修改定时清理配置时应在请求体中传递如下参数:
| 名称 | 类型 | 含义 |
|---|---|---|
| enabled | Boolean | 【必选参数】定时清理缓存功能是否开启。true 表示开启,false 表示关闭。 |
| cycleType | String | 【必选参数】定时清理的周期类型。可选值:day(每天执行)、dayOfWeek(每周执行)、dayOfMonth(每月执行)。 |
| cycleInterval | String | 【可选参数】定时清理的周期值,多个值以英文逗号分隔。当 cycleType 为 dayOfWeek 时,取值为 "1,2,3,4,5,6,7",其中 1 表示周一,7 表示周日;当 cycleType 为 dayOfMonth 时,取值为 "1,20" 等,表示每月指定日期;当 cycleType 为 day 时,该字段可省略。 |
| clearTime | Object | 【必选参数】定时清理的执行时间。 |
| clearTime.hour | Integer | 【必选参数】执行清理的小时,24小时制,取值范围:0-23。 |
| clearTime.minute | Integer | 【必选参数】执行清理的分钟,取值范围:0-59。 |
响应结构
| 字段 | 类型 | 说明 |
|---|---|---|
| succeed | Boolean | 配置是否修改成功。true 表示修改成功。 |
请求示例1:按周执行清理
对 clear-temp/schedule 资源执行 POST 请求,设置每周一至周日(即每天)19:30 清理缓存,URL:http://192.168.17.139:32507/dashboard/web/api/configuration/clear-temp/schedule。
请求头:
content-type: application/json
请求体:
{
"enabled": true,
"cycleType": "dayOfWeek",
"cycleInterval": "1,2,3,4,5,6,7",
"clearTime": {
"hour": 19,
"minute": 30
}
}
返回的内容如下:
{
"succeed": true
}
请求示例2:按每月指定日期执行清理
对 clear-temp/schedule 资源执行 POST 请求,设置每月 1 日和 20 日 19:30 清理缓存,URL:http://192.168.17.139:32507/dashboard/web/api/configuration/clear-temp/schedule。
请求体:
{
"enabled": true,
"cycleType": "dayOfMonth",
"cycleInterval": "1,20",
"clearTime": {
"hour": 19,
"minute": 30
}
}
返回的内容如下:
{
"succeed": true
}
请求示例3:按每天执行清理
对 clear-temp/schedule 资源执行 POST 请求,设置每天 19:30 清理缓存,URL:http://192.168.17.139:32507/dashboard/web/api/configuration/clear-temp/schedule。
请求体:
{
"enabled": true,
"cycleType": "day",
"clearTime": {
"hour": 19,
"minute": 30
}
}
返回的内容如下:
{
"succeed": true
}
相关主题