# App Cache Purge

# 获取缓存刷新任务

# 简介

获取指定应用的缓存刷新任务

# URI

GET /admin-api/applications/http/{app-id}/purge

# URI参数

  • page

    type: integer

    required: no

    description: 第几页 (default 1)

  • page_size

    type: integer

    required: no

    description: 每页大小 (default 20)

  • detail

    type: integer

    is_necessary: no

    description: 传任意值显示详细信息,不传显示简略信息

# 请求示例

# Shell

curl 'https://{admin-site}/admin-api/applications/http/1/purge?page=2&page_size=2&detail=1'

# 响应示例

Status: 200 OK
{
    "data": {
        "data": [
            {
                "type": "conditional",      // 总共2种刷新条件,分别是"conditional"和"urls"
                "_created_unix": 1614369990.6503,
                "id": 1393,
                "conditions": [
                    {                       // uri 以 /cn/ 为前缀
                        "values": [
                            {
                                "type": "str",
                                "id": 2141,
                                "val": "/cn/"
                            }
                        ],
                        "id": 1511,
                        "operator": {
                            "name": "prefix"
                        },
                        "variable": {
                            "args": "",
                            "name": "uri"
                        }
                    },
                    {
                        "values": [         // 值, 主机名是 "openresty.org"
                            {
                                "type": "str",
                                "id": 2142,
                                "val": "openresty.org"
                            }
                        ],
                        "id": 1512,
                        "operator": {       // 操作符
                            "name": "eq"
                        },
                        "variable": {       // 变量
                            "args": "",
                            "name": "host"
                        }
                    }
                ],
                "_modified_unix": 1614369990.6503
            },
            {
                "type": "urls",             // 当url完全匹配时触发
                "_created_unix": 1614045360.6022,
                "id": 1390,
                "urls": "http://openresty.org/en/",
                "_modified_unix": 1614045360.6022
            }
        ],
        "meta": {
            "count": 98
        }
    },
    "status": 0
}

# Post cache purge events

# 简介

创建指定应用的缓存刷新任务

# URI

POST /admin-api/applications/http/{app-id}/purge

# 请求示例

# Shell

curl 'https://{admin-site}/admin-api/applications/http/1/purge'
{
    "type":"conditional",    // 总共2种刷新条件,分别是"conditional"和"urls"
    "note":"clear cache",    // 任务名称
    "conditions":[           // 当uri前缀是/openresty/时触发
        {
            "variable":{     // 值
                "name":"uri"
            },
            "operator":{     // 操作符
                "name":"prefix"
            },
            "values":[       // 变量
                {
                    "type":"str",
                    "val":"/openresty/"
                }
            ],
            "number":0
        }
    ]
}
curl 'https://{admin-site}/admin-api/applications/http/1/purge'
{
    "type":"urls",         // 总共2种刷新条件,分别是"conditional"和"urls"
    "note":"clear cache",  // 任务名称
    "urls": "www.openresty.com"       // 当uri等于www.openresty.com时触发
}

# 响应示例

Status: 200 OK
{
    "status":0,
    "data":{
        "id":1      // 任务id
    }
}

# Delete cache purge event

# 简介

删除指定应用的缓存刷新任务

# URI

DELETE /admin-api/applications/http/{app-id}/purge/{event-id}

# 请求示例

# Shell

curl 'http://{admin-site}/admin-api/applications/http/1/purge/5' -X 'DELETE'

# 响应示例

Status: 200 OK
{
    "status":0
}