系统-缓存设置-保存
接口信息
- 接口地址:
{your-site-url}/api/skill/system-setting/cache-set
- 基础 URL:
{your-site-url} 需替换为你自己的独立站 URL 地址,如 https://your-domain.com/apimanager666
- 请求方式:
POST
- Content-Type:
application/json
- 说明: 此接口用于保存缓存相关配置。这是一个全量保存接口,保存前必须先调用 系统-缓存设置-获取 获取当前配置,然后修改需要的字段,再将所有字段一并提交保存
认证
请求头中需要携带 skill-access-token:
| Header |
值 |
skill-access-token |
{your-skill-access-token} (请替换为你自己的 token) |
请求参数 (JSON Body)
| 字段 |
类型 |
必填 |
说明 |
search_cache_time |
int |
✅ 必填 |
搜索页面缓存过期时间,单位秒。如 3600 代表 1 小时 |
coupon_product_cache_time |
int |
✅ 必填 |
优惠券页缓存过期时间,单位秒。如 3600 代表 1 小时 |
short_review_cache_time |
int |
✅ 必填 |
评论信息缓存过期时间,单位秒。如 3600 代表 1 小时 |
cache_mode |
int |
✅ 必填 |
缓存刷新模式。1 = 自刷新模式,2 = 手动刷新缓存模式 |
page_full_cache |
int |
✅ 必填 |
整页缓存状态。1 = 开启,2 = 关闭 |
page_full_cache_time |
int |
✅ 必填 |
整页缓存过期时间,单位秒。如 604800 代表 7 天 |
page_sections_cache |
int |
✅ 必填 |
sections 局部缓存状态。1 = 开启,2 = 关闭 |
page_sections_cache_time |
int |
✅ 必填 |
sections 局部缓存过期时间,单位秒。如 604800 代表 7 天 |
请求示例
cURL
curl --location --request POST '{your-site-url}/api/skill/system-setting/cache-set' \
--header 'skill-access-token: {your-skill-access-token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"search_cache_time": 43200,
"coupon_product_cache_time": 12,
"short_review_cache_time": 6,
"cache_mode": 1,
"page_full_cache": 2,
"page_full_cache_time": 604800,
"page_sections_cache": 2,
"page_sections_cache_time": 604800
}'
返回结果
code 为 200 表示调用成功;code 不为 200 表示调用失败。
成功响应
{
"code": 200,
"data": [],
"message": "success"
}
返回字段说明
| 字段 |
类型 |
说明 |
code |
Number |
状态码,200 表示成功 |
message |
String |
执行结果的文字描述 |
data |
Array |
返回数据,目前为空数组 |
注意事项
- 这是一个全量保存接口,所有字段均为必填
- 保存前必须先调用 系统-缓存设置-获取 获取当前配置,然后修改需要的字段,再将所有字段一并提交保存
- 注意:api保存是全量保存,即时您只配置修改一个选项,也要进行全量保存,因此,先通过获取api得到数据,然后进行更改数据,然后进行保存