EditCacheTimeConfig

Update time: 2026-08-14 11:23:02

Applicable Products

Media Acceleration Live Broadcast,Content Acceleration,Dynamic Web Acceleration,Media Acceleration VoD

API Description

The interface self-help implementation modifies the domain name cache time configuration, realizes the custom cache function according to the customer's request. Node cache is divided into regular cache and query string URl cache, where you can set the cache time and ignore certain headers that affect the cache, and whether to cache empty files, etc., can the query string Url be set to multiple or to cache the Url after removing the question mark (increasing hit rate)

Call frequency

Single user trigger frequency: 300/5min

Request parameter(s)

Path Params

NameDescription
*domain-nameString
the domain whoes need query config

Body Params

NameDescription
*cache-time-behaviorsList
Cache time configuration note: 1. When you need to cancel the cache time configuration setting, you can pass in the empty node . 2. When it is required to set the cache time configuration, this item is required.
data-idLong
dataId is to indicate a specific group configuration when the client has multiple groups of configurations. dataId can be retrieved through a query interface. Note: 1. If dataId is passed, it means that one group of configuration items is specified to be modified, and no other group configuration items need to be modified. 2. If multiple groups of configurations are included, some of them are configured with dataId and others are not, then the expression of dataId is used to modify a specific group of configurations, and a new group of configurations is added on the original basis without the expression of dataId. 3. If the dataId is not passed, it means that the original configuration will be fully covered by this configuration. 4. If no configuration parameter is passed, only domain name and secondary label are passed. It means that all configuration corresponding to this interface is cleared. 5. If there is no specific configuration item in a set of configurations, the dataId must be filled in, and the value should be the actual dataId, which means clearing the value of the corresponding dataId configuration item. 6. Tt is not allowed when neither configuration item nor dataId is specified in a set of configurations.
path-patternString
The url matching mode supports fuzzy regularization. If all matches, the input parameters can be configured as: .*
except-path-patternString
Exceptional url matching mode, except for some URLs: such as abc.jpg, do not do anti-theft chain function E.g: ^https?://[^/]+/.*\.m3u8
custom-patternString
Specify common types: Select the domain name that requires the cache to be all files or the home page. : E.g: All: all files Homepage: homepage
file-typeString
File Type: Specify the file type for cache settings. File types include: gif png bmp jpeg jpg html htm shtml mp3 wma flv mp4 wmv zip exe rar css txt ico js swf If you need all types, pass all directly. Multiples are separated by semicolons, and all and specific file types cannot be configured at the same time.
custom-file-typeString
Custom file type: Fill in the appropriate identifiable file type according to your needs outside of the specified file type. Can be used with file-type. If the file-type is also configured, the actual file type is the sum of the two parameters.
specify-url-patternString
Specify URL cache: Specify url according to requirements for cache INS format does not support URI format with http(s)://
directoryString
Directory: Specify the directory cache. Enter a legal directory format. Multiple separated by semicolons
cache-ttlString
Cache time: set the time corresponding to the cache object Input format: integer plus unit, such as 20s, 30m, 1h, 2d, no cache is set to 0. Do not enter the unit default is seconds There is no upper limit on the cache time theory. This time is set according to the customer's own needs. If the customer feels that some of the files are not changed frequently, then the setting is longer. For example, the text class js, css, html, etc. can be set shorter, the picture, video and audio classes can be set longer (because the cache time will be replaced by the new file due to the file heat algorithm, the longest suggestion Do not exceed one month)
ignore-cache-controlString
Ignore the source station does not cache the header. The optional values are true and false, which are used to ignore the two configurations of cache-control in the request header (private, no-cache) and the Authorization set by the client. The ture indicates that the source station's settings for the three are ignored. Enables resources to be cached on the service node in the form of cache-control: public, and then our nodes can cache this type of resource and provide acceleration services. False means that when the source station sets cache-control: private, cache-control: no-cache for a resource or specifies to cache according to authorization, our service node will not cache such files.
is-respect-serverString
Respect the server: Accelerate whether to prioritize the source cache time. Optional values: true and false True: indicates that the server is time-first False: The cache time of the CDN configuration takes precedence.
ignore-letter-caseString
Ignore case, the optional value is true or false, true means to ignore case; false means not to ignore case; When adding a new configuration item, the default is not true.
reload-manageString
Reload processing rules, optional: ignore or if-modified-since If-modified-since: indicates that you want to convert to if-modified-since Ignore: means to ignore client refresh
priorityString
Indicates the priority execution order of multiple sets of redirected content by the customer. The higher the number, the higher the priority. When adding a new configuration item, the default is 10
ignore-authentication-headerString
You can set it 'true' to cache ignoring the http header 'Authentication'. If it is empty, the header is not ignored by default.
uaString
UA
exception-uaString
Exceptional UA
uri-match-patternString
Specify URI match pattern. E.g: exact: exact match parameter-ignoring: parameter ignoring match
descriptionString
description

Response parameter(s)

Body Params

NameDescription
codeString
Error code, which appears when HTTPStatus is not 202, represents the error type of the current request call
messageString
Response message, and shows as success when it is successful.

Error code

Error code(code)Description(message)HTTP statusSemantic
InvalidParameterAll other properties are null, and the dataId cannot be null400All other properties are null, and the dataId cannot be null

Example

JSON
XML
JSON
Request example
Copy Copy success
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://{@apiDomain}/api/config/cachetime/123344" \
-X "PUT" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-d '{
    "cache-time-behaviors": [
        {
            "data-id": "31506459", 
            "path-pattern": ".*", 
            "cache-ttl": "30s", 
            "ignore-cache-control": "true", 
            "is-respect-server": "false", 
            "ignore-letter-case": "true", 
            "reload-manage": "ignore", 
            "priority": "10",
            "ua": "Mobile",
            "exception-ua": "ie|edge"
        }, 
        {
            "path-pattern": ".*", 
            "cache-ttl": "30s", 
            "ignore-cache-control": "false", 
            "is-respect-server": "true", 
            "ignore-letter-case": "true", 
            "reload-manage": "if-modified-since", 
            "priority": "10"
        }
    ],
    "description":"description"
}'
Response example
Copy Copy success
HTTP/1.1 202 Accepted
Date: Fri, 17 May 2017 06:33:26 GMT
Content-Type: application/json;charset=utf-8
x-cnc-request-id:c54cbbb4-19fe-407a-930c-3988b62ed2fd
{"message":"success"}