快取重新整理

獲取指定應用的快取重新整理任務

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
}

建立指定應用的快取重新整理任務

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
    }
}

刪除指定應用的快取重新整理任務

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
}