Baidu AI Cloud
中国站

百度智能云

CDN Abroad

Set the Cache Expiration Rules

Interface

This interface is used to set cache expiration rules.

Method Path Description
PUT /v2/abroad/domain/{domain}/config?cacheTtl Set cache expiration rules

Request Body

Parameter Optional Type Description
cacheTtl Required list List of cache rules

cacheTtl field description:

Field Optional Type Description
type No string Cache type, path is a directory, file is a specific uri, and suffix is a suffix.
value No string Path name
ttl No int Cache time (seconds)
weight No int Weight
override_origin Yes bollean Whether to overwrite the cache rules of the origin server

Response code(Http Status Code)

Http Status Code Description
200 Successfully configured
400 body format error

Request example

PUT /v2/abroad/domain/test.bcecdn.com/config?cacheTtl= HTTP/1.1 
x-bce-date: 2018-11-21T09:06:06Z 
Host: cdn.baidubce.com 
Content-Length: 184

{ 
    "cacheTtl":[ 
        {"type":"suffix", "value": ".jpg", "ttl": 60, "weight": 30, "override_origin":false}, 
        {"type':"path", "value": "/", "ttl": 60, "weight": 10, "override_origi":true} 
    ] 
} 

Response example

HTTP/1.1 200 OK 
Server: nginx 
Date: Wed, 21 Nov 2018 09:06:07 GMT 
Content-Type: application/json; charset=utf-8 
Connection: keep-alive 
x-bce-request-id: bc3bb3b3-673f-13c5-eec-2ab2eda58677

{"requestId":"bc3bb3b3-673f-13c5-eec-2ab2eda58677","code":"success","message":"update cache config success"}
Previous
Update the Forward-to-origin Address of the Acceleration Domain Name
Next
Set the Cache Parameter Filter Rules