设置节点缓存配置
更新时间:2026-06-05
接口
本接口用于设置站点的节点缓存配置。
请求接口
| Method | Path | 说明 |
|---|---|---|
| PUT | /v2/geo/site/{site}/config | 设置节点配置接口 |
site:表示用户要设置的站点。
请求体
| 参数 | 类型 | 可选 | 说明 |
|---|---|---|---|
| cacheTtl | List<CacheTtl> | 必选 | 节点的缓存规则。 |
响应码
| HTTP Status Code | 说明 |
|---|---|
| 200 | 设置节点配置成功 |
| 其他错误码 | 配置参数错误 |
响应体
| 参数 | 类型 | 说明 |
|---|---|---|
| status | String | 表示修改该配置的状态。设置配置成功,其值为“RUNNING”。否则返回报错信息。 |
请求示例1: 遵循源站-默认缓存策略
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "cacheTtl": []
10}
请求示例2: 遵循源站-不缓存
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "cacheTtl": [
10 {
11 "value": "/",
12 "weight": 100,
13 "override_origin": false,
14 "ttl": 0,
15 "type": "path"
16 }
17 ]
18}
请求示例3:遵循源站-自定义缓存时间
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "cacheTtl": [
10 {
11 "value": "/",
12 "weight": 100,
13 "override_origin": false,
14 "ttl": 259200,
15 "type": "path"
16 }
17 ]
18}
请求示例4:自定义缓存时间
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "cacheTtl": [
10 {
11 "value": "/",
12 "weight": 100,
13 "override_origin": true,
14 "ttl": 2592000,
15 "type": "path"
16 }
17 ]
18}
请求示例5:不缓存
Plain Text
1PUT /v2/geo/site/test.com/config HTTP/1.1
2Host: geo.baidubce.com
3Content-Length: 46
4Authorization: xxx
5Content-Type: application/json;charset=utf-8
6Accept-Encoding: gzip
7
8{
9 "cacheTtl": [
10 {
11 "value": "/",
12 "weight": 100,
13 "override_origin": true,
14 "ttl": 0,
15 "type": "path"
16 }
17 ]
18}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Server: nginx/1.16.1
3Content-Type: application/json; charset=utf-8
4Transfer-Encoding: chunked
5Connection: keep-alive
6
7{
8 "status": "RUNNING"
9}
评价此篇文章
