# HTTPCachePolicyService
> 缓存策略服务

---

## countAllEnabledHTTPCachePolicies
> 计算缓存策略数量

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/countAllEnabledHTTPCachePolicies`
- RPC：`rpc countAllEnabledHTTPCachePolicies (CountAllEnabledHTTPCachePoliciesRequest) returns (RPCCountResponse);`

**请求对象 (`CountAllEnabledHTTPCachePoliciesRequest`)**

```json
{
  "keyword": "string // 关键词",
  "nodeClusterId": "int64 // 集群ID",
  "type": "string"
}
```

**响应对象 (`RPCCountResponse`)**

```json
{
  "count": "int64 // 数量"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/countAllEnabledHTTPCachePolicies" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## createHTTPCachePolicy
> 创建缓存策略

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/createHTTPCachePolicy`
- RPC：`rpc createHTTPCachePolicy (CreateHTTPCachePolicyRequest) returns (CreateHTTPCachePolicyResponse);`

**请求对象 (`CreateHTTPCachePolicyRequest`)**

```json
{
  "isOn": "bool // 是否启用",
  "name": "string // 名称",
  "description": "string // 描述（备注）",
  "capacityJSON": "bytes",
  "maxSizeJSON": "bytes",
  "type": "string",
  "optionsJSON": "bytes",
  "syncCompressionCache": "bool",
  "fetchTimeoutJSON": "bytes // 预热超时时间"
}
```

**响应对象 (`CreateHTTPCachePolicyResponse`)**

```json
{
  "httpCachePolicyId": "int64"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/createHTTPCachePolicy" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## deleteHTTPCachePolicy
> 删除缓存策略

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/deleteHTTPCachePolicy`
- RPC：`rpc deleteHTTPCachePolicy (DeleteHTTPCachePolicyRequest) returns (RPCSuccess);`

**请求对象 (`DeleteHTTPCachePolicyRequest`)**

```json
{
  "httpCachePolicyId": "int64"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/deleteHTTPCachePolicy" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findAllEnabledHTTPCachePolicies
> 获取所有可用策略

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/findAllEnabledHTTPCachePolicies`
- RPC：`rpc findAllEnabledHTTPCachePolicies (FindAllEnabledHTTPCachePoliciesRequest) returns (FindAllEnabledHTTPCachePoliciesResponse);`

**请求对象 (`FindAllEnabledHTTPCachePoliciesRequest`)**

```json
{}
```

**响应对象 (`FindAllEnabledHTTPCachePoliciesResponse`)**

```json
{
  "cachePolicies": "[]HTTPCachePolicy"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/findAllEnabledHTTPCachePolicies" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findEnabledHTTPCachePolicy
> 查找单个缓存策略信息

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/findEnabledHTTPCachePolicy`
- RPC：`rpc findEnabledHTTPCachePolicy (FindEnabledHTTPCachePolicyRequest) returns (FindEnabledHTTPCachePolicyResponse);`

**请求对象 (`FindEnabledHTTPCachePolicyRequest`)**

```json
{
  "httpCachePolicyId": "int64"
}
```

**响应对象 (`FindEnabledHTTPCachePolicyResponse`)**

```json
{
  "httpCachePolicy": "HTTPCachePolicy"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/findEnabledHTTPCachePolicy" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## findEnabledHTTPCachePolicyConfig
> 查找单个缓存策略配置

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/findEnabledHTTPCachePolicyConfig`
- RPC：`rpc findEnabledHTTPCachePolicyConfig (FindEnabledHTTPCachePolicyConfigRequest) returns (FindEnabledHTTPCachePolicyConfigResponse);`

**请求对象 (`FindEnabledHTTPCachePolicyConfigRequest`)**

```json
{
  "httpCachePolicyId": "int64"
}
```

**响应对象 (`FindEnabledHTTPCachePolicyConfigResponse`)**

```json
{
  "httpCachePolicyJSON": "bytes"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/findEnabledHTTPCachePolicyConfig" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## listEnabledHTTPCachePolicies
> 列出单页的缓存策略

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/listEnabledHTTPCachePolicies`
- RPC：`rpc listEnabledHTTPCachePolicies (ListEnabledHTTPCachePoliciesRequest) returns (ListEnabledHTTPCachePoliciesResponse);`

**请求对象 (`ListEnabledHTTPCachePoliciesRequest`)**

```json
{
  "offset": "int64 // 读取位置",
  "size": "int64 // 数量，通常不能小于0",
  "keyword": "string // 关键词",
  "nodeClusterId": "int64 // 集群ID",
  "type": "string"
}
```

**响应对象 (`ListEnabledHTTPCachePoliciesResponse`)**

```json
{
  "httpCachePoliciesJSON": "bytes"
}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/listEnabledHTTPCachePolicies" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## updateHTTPCachePolicy
> 修改缓存策略

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/updateHTTPCachePolicy`
- RPC：`rpc updateHTTPCachePolicy (UpdateHTTPCachePolicyRequest) returns (RPCSuccess);`

**请求对象 (`UpdateHTTPCachePolicyRequest`)**

```json
{
  "httpCachePolicyId": "int64",
  "isOn": "bool // 是否启用",
  "name": "string // 名称",
  "description": "string // 描述（备注）",
  "capacityJSON": "bytes",
  "maxSizeJSON": "bytes",
  "type": "string",
  "optionsJSON": "bytes",
  "syncCompressionCache": "bool",
  "fetchTimeoutJSON": "bytes // 预热超时时间"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/updateHTTPCachePolicy" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---

## updateHTTPCachePolicyRefs
> 设置缓存策略的默认条件

- 角色：`admin`
- HTTP：`POST https://backend.dooki.cloud/HTTPCachePolicyService/updateHTTPCachePolicyRefs`
- RPC：`rpc updateHTTPCachePolicyRefs (UpdateHTTPCachePolicyRefsRequest) returns (RPCSuccess);`

**请求对象 (`UpdateHTTPCachePolicyRefsRequest`)**

```json
{
  "httpCachePolicyId": "int64",
  "refsJSON": "bytes"
}
```

**响应对象 (`RPCSuccess`)**

```json
{}
```

**调用示例**

```bash
curl -X POST "https://backend.dooki.cloud/HTTPCachePolicyService/updateHTTPCachePolicyRefs" \
  -H "Content-Type: application/json" \
  -H "X-Edge-Access-Token: <YOUR_TOKEN>" \
  -d '{
    ...
  }'
```

---
