You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sy...@apache.org on 2022/09/06 03:52:07 UTC

[apisix] branch master updated: docs(plugin): refactor proxy-cache.md (#7858)

This is an automated email from the ASF dual-hosted git repository.

sylviasu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new d970f712c docs(plugin): refactor proxy-cache.md (#7858)
d970f712c is described below

commit d970f712cf2225ba573ff1dbce9773c88a0dd2b8
Author: Yuedong Wu <57...@users.noreply.github.com>
AuthorDate: Tue Sep 6 11:52:01 2022 +0800

    docs(plugin): refactor proxy-cache.md (#7858)
    
    * docs: update proxy-cache.md
    
    * update ref reviews
---
 docs/en/latest/plugins/proxy-cache.md |  59 +++------
 docs/zh/latest/plugins/proxy-cache.md | 241 ++++++++--------------------------
 2 files changed, 77 insertions(+), 223 deletions(-)

diff --git a/docs/en/latest/plugins/proxy-cache.md b/docs/en/latest/plugins/proxy-cache.md
index 42fd1101d..0b10f54a8 100644
--- a/docs/en/latest/plugins/proxy-cache.md
+++ b/docs/en/latest/plugins/proxy-cache.md
@@ -2,10 +2,9 @@
 title: proxy-cache
 keywords:
   - APISIX
-  - Plugin
+  - API Gateway
   - Proxy Cache
-  - proxy-cache
-description: This document contains information about the Apache APISIX proxy-cache Plugin.
+description: This document contains information about the Apache APISIX proxy-cache Plugin, you can use it to cache the response from the Upstream.
 ---
 <!--
 #
@@ -28,7 +27,7 @@ description: This document contains information about the Apache APISIX proxy-ca
 
 ## Description
 
-The `proxy-cache` Plugin can be used to cache the response from the Upstream. It can be used with other Plugins and currently supports disk-based caching.
+The `proxy-cache` Plugin can be used to cache the response from the Upstream. It can be used with other Plugins and currently supports disk-based and memory-based caching.
 
 The data to be cached can be filtered with response codes, request modes, or more complex methods using the `no_cache` and `cache_bypass` attributes.
 
@@ -37,25 +36,22 @@ The data to be cached can be filtered with response codes, request modes, or mor
 | Name               | Type           | Required | Default                   | Valid values            | Description                                                                                                                                                                                                                                                                                           |
 |--------------------|----------------|----------|---------------------------|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | cache_strategy     | string         | False    | disk                      | ["disk","memory"]       | Specifies where the cached data should be stored.                                                                                                                                                                                                                                                     |
-| cache_zone         | string         | False    | disk_cache_one            |                         | Specifies which cache area to use. Each cache area can be configured with different paths. Cache areas can be predefined in your configuration file (conf/config.yaml). If the specified cache area is inconsistent with the pre-defined cache area in your configuration file, the cache is invalid. |
+| cache_zone         | string         | False    | disk_cache_one            |                         | Specifies which cache area to use. Each cache area can be configured with different paths. Cache areas can be predefined in your configuration file (`conf/config.yaml`). If the specified cache area is inconsistent with the pre-defined cache area in your configuration file, the cache is invalid. |
 | cache_key          | array[string]  | False    | ["$host", "$request_uri"] |                         | Key to use for caching. For example, `["$host", "$uri", "-cache-id"]`.                                                                                                                                                                                                                                |
-| cache_bypass       | array[string]  | False    |                           |                         | Conditions in which response from cache is bypassed. Whether to skip cache retrieval. If at least one value of the string parameters is not empty and is not equal to “0” then the response will not be taken from the cache. For example, `["$arg_bypass"]`.                                         |
+| cache_bypass       | array[string]  | False    |                           |                         | Conditions in which response from cache is bypassed. Whether to skip cache retrieval. If at least one value of the string parameters is not empty and is not equal to `0` then the response will not be taken from the cache. For example, `["$arg_bypass"]`.                                         |
 | cache_method       | array[string]  | False    | ["GET", "HEAD"]           | ["GET", "POST", "HEAD"] | Request methods for which the response will be cached.                                                                                                                                                                                                                                                |
 | cache_http_status  | array[integer] | False    | [200, 301, 404]           | [200, 599]              | HTTP status codes of the Upstream response for which the response will be cached.                                                                                                                                                                                                                     |
-| hide_cache_headers | boolean        | False    | false                     |                         | When set to true adds the `Expires` and `Cache-Control` headers to the client response.                                                                                                                                                                                                               |
-| cache_control      | boolean        | False    | false                     |                         | When set to true, complies with Cache-Control behavior in the HTTP specification. Used only for memory strategy.                                                                                                                                                                                      |
-| no_cache           | array[string]  | False    |                           |                         | Conditions in which the response will not be cached. If at least one value of the string parameters is not empty and is not equal to “0” then the response will not be saved.                                                                                                                         |
+| hide_cache_headers | boolean        | False    | false                     |                         | When set to `true` adds the `Expires` and `Cache-Control` headers to the client response.                                                                                                                                                                                                               |
+| cache_control      | boolean        | False    | false                     |                         | When set to `true`, complies with Cache-Control behavior in the HTTP specification. Used only for memory strategy.                                                                                                                                                                                      |
+| no_cache           | array[string]  | False    |                           |                         | Conditions in which the response will not be cached. If at least one value of the string parameters is not empty and is not equal to `0` then the response will not be saved.                                                                                                                         |
 | cache_ttl          | integer        | False    | 300 seconds               |                         | Time that a response is cached until it is deleted or refreshed. Comes in to effect when the `cache_control` attribute is not enabled or the proxied server does not return cache header. Used only for memory strategy.                                                                              |
 
 :::note
 
-The cache expiration time cannot be configured dynamically. It can only be set by the Upstream response header `Expires` or `Cache-Control`. The default expiration time is 10s if there is no `Expires` or `Cache-Control` in the Upstream response header.
-
-If the Upstream service is not available and APISIX returns a 502 or 504 status code, it will be cached for 10s.
-
-Variables (start with `$`) can be specified in `cache_key`, `cache_bypass` and `no_cache`. It's worth mentioning that the variable value will be an empty string if it doesn't exist.
-
-You can also combine a number of variables and strings (constants), by writing them into an array, eventually, variables will be parsed and stitched together with strings.
+- The cache expiration time cannot be configured dynamically. It can only be set by the Upstream response header `Expires` or `Cache-Control`. The default expiration time is 10s if there is no `Expires` or `Cache-Control` in the Upstream response header.
+- If the Upstream service is not available and APISIX returns a `502` or `504` status code, it will be cached for 10s.
+- Variables (start with `$`) can be specified in `cache_key`, `cache_bypass` and `no_cache`. It's worth mentioning that the variable value will be an empty string if it doesn't exist.
+- You can also combine a number of variables and strings (constants), by writing them into an array, eventually, variables will be parsed and stitched together with strings.
 
 :::
 
@@ -77,7 +73,8 @@ proxy_cache:
 You can enable the Plugin on a specific Route as shown below:
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
     "plugins": {
         "proxy-cache": {
@@ -111,12 +108,7 @@ curl http://127.0.0.1:9080/hello -i
 
 ```shell
 HTTP/1.1 200 OK
-Content-Type: application/octet-stream
-Content-Length: 6
-Connection: keep-alive
-Server: APISIX web server
-Date: Tue, 03 Mar 2020 10:45:36 GMT
-Last-Modified: Tue, 03 Mar 2020 10:36:38 GMT
+···
 Apisix-Cache-Status: MISS
 
 hello
@@ -130,22 +122,17 @@ curl http://127.0.0.1:9080/hello -i
 
 ```shell
 HTTP/1.1 200 OK
-Content-Type: application/octet-stream
-Content-Length: 6
-Connection: keep-alive
-Server: APISIX web server
-Date: Tue, 03 Mar 2020 11:14:46 GMT
-Last-Modified: Thu, 20 Feb 2020 14:21:41 GMT
+···
 Apisix-Cache-Status: HIT
 
 hello
 ```
 
-If you set `"cache_zone": "invalid_disk_cache"` attribute to an invalid value (cache not configured in the your configuration file), then it will return a 404 response.
+If you set `"cache_zone": "invalid_disk_cache"` attribute to an invalid value (cache not configured in the your configuration file), then it will return a `404` response.
 
 :::tip
 
-To clear the cached data, you can send a request with PURGE method:
+To clear the cached data, you can send a request with `PURGE` method:
 
 ```shell
 curl -i http://127.0.0.1:9080/hello -X PURGE
@@ -153,14 +140,9 @@ curl -i http://127.0.0.1:9080/hello -X PURGE
 
 ```shell
 HTTP/1.1 200 OK
-Date: Tue, 03 Mar 2020 11:17:35 GMT
-Content-Type: text/plain
-Transfer-Encoding: chunked
-Connection: keep-alive
-Server: APISIX web server
 ```
 
-If the response code is 200, the deletion is successful. If the cached data is not found, a 404 response code will be returned.
+If the response code is `200`, the deletion is successful. If the cached data is not found, a `404` response code will be returned.
 
 :::
 
@@ -169,7 +151,8 @@ If the response code is 200, the deletion is successful. If the cached data is n
 To disable the `proxy-cache` Plugin, you can delete the corresponding JSON configuration from the Plugin configuration. APISIX will automatically reload and you do not have to restart for this to take effect.
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
     "uri": "/hello",
     "plugins": {},
diff --git a/docs/zh/latest/plugins/proxy-cache.md b/docs/zh/latest/plugins/proxy-cache.md
index 592134577..0fb5c9acb 100644
--- a/docs/zh/latest/plugins/proxy-cache.md
+++ b/docs/zh/latest/plugins/proxy-cache.md
@@ -1,5 +1,10 @@
 ---
 title: proxy-cache
+keywords:
+  - APISIX
+  - API 网关
+  - Request Validation
+description: 本文介绍了 Apache APISIX proxy-cache 插件的相关操作,你可以使用此插件缓存来自上游的响应。
 ---
 
 <!--
@@ -23,53 +28,51 @@ title: proxy-cache
 
 ## 描述
 
-代理缓存插件,该插件提供缓存后端响应数据的能力,它可以和其他插件一起使用。该插件支持基于磁盘的缓存,未来也会支持基于内存的缓存。目前可以根据响应码、请求 Method 来指定需要缓存的数据,另外也可以通过 no_cache 和 cache_bypass 配置更复杂的缓存策略。
-
-基于磁盘的缓存需要注意:
-
-1. 不能动态配置缓存的过期时间,只能通过后端服务响应头 Expires 或 Cache-Control 来设置过期时间,如果后端响应头中没有 Expires 或 Cache-Control,那么 APISIX 将默认只缓存 10 秒钟
-2. 如果后端服务不可用, APISIX 将返回 502 或 504,那么 502 或 504 将被缓存 10 秒钟
+`proxy-cache` 插件提供缓存后端响应数据的能力,它可以和其他插件一起使用。该插件支持基于磁盘和内存的缓存。目前可以根据响应码和请求模式来指定需要缓存的数据,也可以通过 `no_cache` 和 `cache_bypass`属性配置更复杂的缓存策略。
 
 ## 属性
 
 | 名称               | 类型           | 必选项 | 默认值                    | 有效值                                                                          | 描述                                                                                                                               |
 | ------------------ | -------------- | ------ | ------------------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
-| cache_strategy     | string         | 可选   | disk                      | ["disk","memory"]                                                               | 缓存策略,指定缓存数据存储在磁盘还是内存中 |
-| cache_zone         | string         | 可选   |        disk_cache_one     |                                                                                 | 指定使用哪个缓存区域,不同的缓存区域可以配置不同的路径,在 conf/config.yaml 文件中可以预定义使用的缓存区域。当不使用默认值时,指定的缓存区域与 conf/config.yaml 文件中预定义的缓存区域不一致,缓存无效。   |
-| cache_key          | array[string]  | 可选   | ["$host", "$request_uri"] |                                                                                 | 缓存 key,可以使用变量。例如:["$host", "$uri", "-cache-id"]                                                                        |
-| cache_bypass       | array[string]  | 可选   |                           |                                                                                 | 是否跳过缓存检索,即不在缓存中查找数据,可以使用变量,需要注意当此参数的值不为空或非'0'时将会跳过缓存的检索。例如:["$arg_bypass"] |
-| cache_method       | array[string]  | 可选   | ["GET", "HEAD"]           | ["GET", "POST", "HEAD"] | 根据请求 method 决定是否需要缓存                                                                                                     |
-| cache_http_status  | array[integer] | 可选   | [200, 301, 404]           | [200, 599]                                                                      | 根据响应码决定是否需要缓存                                                                                                         |
-| hide_cache_headers | boolean        | 可选   | false                     |                                                                                 | 是否将 Expires 和 Cache-Control 响应头返回给客户端                                                                                 |
-| cache_control      | boolean        | 可选   | false                     |                                                                                 | 是否遵守 HTTP 协议规范中的 Cache-Control 的行为                                 |
-| no_cache           | array[string]  | 可选   |                           |                                                                                 | 是否缓存数据,可以使用变量,需要注意当此参数的值不为空或非'0'时将不会缓存数据                                                      |
-| cache_ttl          | integer        | 可选   | 300 秒                    |                                                                                 | 当选项 cache_control 未开启或开启以后服务端没有返回缓存控制头时,提供的默认缓存时间    |
-
-注:变量以$开头,不存在时等价于空字符串。也可以使用变量和字符串的结合,但是需要以数组的形式分开写,最终变量被解析后会和字符串拼接在一起。
-
-在 `conf/config.yaml` 文件中的配置示例:
-
-```yaml
+| cache_strategy     | string         | 否   | disk                      | ["disk","memory"]                                                               | 缓存策略,指定缓存数据存储在磁盘还是内存中。 |
+| cache_zone         | string         | 否   | disk_cache_one     |                                                                                 | 指定使用哪个缓存区域,不同的缓存区域可以配置不同的路径,在 `conf/config.yaml` 文件中可以预定义使用的缓存区域。如果指定的缓存区域与配置文件中预定义的缓存区域不一致,那么缓存无效。   |
+| cache_key          | array[string]  | 否   | ["$host", "$request_uri"] |                                                                                 | 缓存 key,可以使用变量。例如:`["$host", "$uri", "-cache-id"]`。                                                                        |
+| cache_bypass       | array[string]  | 否   |                           |                                                                                 | 当该属性的值不为空或者非 `0` 时则会跳过缓存检查,即不在缓存中查找数据,可以使用变量,例如:`["$arg_bypass"]`。 |
+| cache_method       | array[string]  | 否   | ["GET", "HEAD"]           | ["GET", "POST", "HEAD"] | 根据请求 method 决定是否需要缓存。                                                                                                     |
+| cache_http_status  | array[integer] | 否   | [200, 301, 404]           | [200, 599]                                                                      | 根据 HTTP 响应码决定是否需要缓存。                                                                                                         |
+| hide_cache_headers | boolean        | 否   | false                     |                                                                                 | 当设置为 `true` 时将 `Expires` 和 `Cache-Control` 响应头返回给客户端。                                                                                 |
+| cache_control      | boolean        | 否   | false                     |                                                                                 | 当设置为 `true` 时遵守 HTTP 协议规范中的 `Cache-Control` 的行为。                                 |
+| no_cache           | array[string]  | 否   |                           |                                                                                 | 当此参数的值不为空或非 `0` 时将不会缓存数据,可以使用变量。                                                      |
+| cache_ttl          | integer        | 否   | 300 秒                    |                                                                                 | 当选项 `cache_control` 未开启或开启以后服务端没有返回缓存控制头时,提供的默认缓存时间。    |
+
+:::note 注意
+
+- 对于基于磁盘的缓存,不能动态配置缓存的过期时间,只能通过后端服务响应头 `Expires` 或 `Cache-Control` 来设置过期时间,当后端响应头中没有 `Expires` 或 `Cache-Control` 时,默认缓存时间为 10 秒钟
+- 当上游服务不可用时, APISIX 将返回 `502` 或 `504` HTTP 状态码,默认缓存时间为 10 秒钟;
+- 变量以 `$` 开头,不存在时等价于空字符串。也可以使用变量和字符串的结合,但是需要以数组的形式分开写,最终变量被解析后会和字符串拼接在一起。
+
+:::
+
+## 启用插件
+
+你可以在 APISIX 配置文件 `conf/config.yaml` 中添加你的缓存配置,示例如下:
+
+```yaml title="conf/config.yaml"
 proxy_cache:                       # 代理缓存配置
     cache_ttl: 10s                 # 如果上游未指定缓存时间,则为默认缓存时间
     zones:                         # 缓存的参数
-    - name: disk_cache_one         # 缓存名称 (缓存区域),管理员可以通过 admin api 中的 cache_zone 字段指定要使用的缓存区域
+    - name: disk_cache_one         # 缓存名称(缓存区域),管理员可以通过 admin api 中的 cache_zone 字段指定要使用的缓存区域
       memory_size: 50m             # 共享内存的大小,用于存储缓存索引
       disk_size: 1G                # 磁盘大小,用于存储缓存数据
       disk_path: "/tmp/disk_cache_one" # 存储缓存数据的路径
       cache_levels: "1:2"          # 缓存的层次结构级别
 ```
 
-## 示例
-
-### 启用插件
-
-示例一:cache_zone 参数默认为 `disk_cache_one`
-
-1、为特定路由启用 `proxy-cache` 插件:
+以下示例展示了如何在指定路由上启用 `proxy-cache` 插件,`cache_zone` 字段默认设置为 `disk_cache_one`:
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
     "plugins": {
         "proxy-cache": {
@@ -91,195 +94,65 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
 }'
 ```
 
-测试:
+## 测试插件
 
-```shell
-$ curl http://127.0.0.1:9080/hello -i
-HTTP/1.1 200 OK
-Content-Type: application/octet-stream
-Content-Length: 6
-Connection: keep-alive
-Server: APISIX web server
-Date: Tue, 03 Mar 2020 10:45:36 GMT
-Last-Modified: Tue, 03 Mar 2020 10:36:38 GMT
-Apisix-Cache-Status: MISS
+按上述配置启用插件后,使用 `curl` 命令请求该路由:
 
-hello
+```shell
+curl http://127.0.0.1:9080/hello -i
 ```
 
-> http status 返回 `200` 并且响应头中包含 `Apisix-Cache-Status`,表示该插件已启用。
-
-2、验证数据是否被缓存,再次请求上边的地址:
+如果返回 `200` HTTP 状态码,并且响应头中包含 `Apisix-Cache-Status`字段,则表示该插件已启用:
 
 ```shell
-$ curl http://127.0.0.1:9080/hello -i
 HTTP/1.1 200 OK
-Content-Type: application/octet-stream
-Content-Length: 6
-Connection: keep-alive
-Server: APISIX web server
-Date: Tue, 03 Mar 2020 11:14:46 GMT
-Last-Modified: Thu, 20 Feb 2020 14:21:41 GMT
-Apisix-Cache-Status: HIT
+···
+Apisix-Cache-Status: MISS
 
 hello
 ```
 
-> 响应头  Apisix-Cache-Status 值变为了 HIT,说明数据已经被缓存
-
-示例二:自定义 cache_zone 参数为 `disk_cache_two`
-
-1、在 `conf/config.yaml` 文件中的指定缓存区域等信息:
-
-```yaml
-proxy_cache:
-    cache_ttl: 10s
-    zones:
-    - name: disk_cache_two
-      memory_size: 50m
-      disk_size: 1G
-      disk_path: "/tmp/disk_cache_one"
-      cache_levels: "1:2"
-```
-
-2、为特定路由启用 `proxy-cache` 插件:
-
-```shell
-$ curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
-{
-    "plugins": {
-        "proxy-cache": {
-            "cache_zone": "disk_cache_two",
-            "cache_key":  ["$uri", "-cache-id"],
-            "cache_bypass": ["$arg_bypass"],
-            "cache_method": ["GET"],
-            "cache_http_status": [200],
-            "hide_cache_headers": true,
-            "no_cache": ["$arg_test"]
-        }
-    },
-    "upstream": {
-        "nodes": {
-            "127.0.0.1:1999": 1
-        },
-        "type": "roundrobin"
-    },
-    "uri": "/hello"
-}'
-```
-
-测试:
+如果你是第一次请求该路由,数据未缓存,那么 `Apisix-Cache-Status` 字段应为 `MISS`。此时再次请求该路由:
 
 ```shell
-$ curl http://127.0.0.1:9080/hello -i
-HTTP/1.1 200 OK
-Content-Type: application/octet-stream
-Content-Length: 6
-Connection: keep-alive
-Server: APISIX web server
-Date: Tue, 03 Mar 2020 10:45:36 GMT
-Last-Modified: Tue, 03 Mar 2020 10:36:38 GMT
-Apisix-Cache-Status: MISS
-
-hello
+curl http://127.0.0.1:9080/hello -i
 ```
 
-> http status 返回 `200` 并且响应头中包含 `Apisix-Cache-Status`,表示该插件已启用。
-
-3、验证数据是否被缓存,再次请求上面的地址:
+如果返回的响应头中 `Apisix-Cache-Status` 字段变为 `HIT`,则表示数据已被缓存,插件生效:
 
 ```shell
-$ curl http://127.0.0.1:9080/hello -i
 HTTP/1.1 200 OK
-Content-Type: application/octet-stream
-Content-Length: 6
-Connection: keep-alive
-Server: APISIX web server
-Date: Tue, 03 Mar 2020 11:14:46 GMT
-Last-Modified: Thu, 20 Feb 2020 14:21:41 GMT
+···
 Apisix-Cache-Status: HIT
 
 hello
 ```
 
-> 响应头 `Apisix-Cache-Status` 值变为了 HIT,说明数据已经被缓存
+如果你设置 `"cache_zone": "invalid_disk_cache"` 属性为无效值,即与配置文件 `conf/config.yaml` 中指定的缓存区域不一致,那么它将返回 `404` HTTP 响应码。
 
-示例 3:指定 cache_zone 为 `invalid_disk_cache` 与 `conf/config.yaml` 文件中指定的缓存区域 `disk_cache_one` 不一致。
+:::tip 提示
 
-```shell
-$ curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
-{
-    "plugins": {
-        "proxy-cache": {
-            "cache_zone": "invalid_disk_cache",
-            "cache_key":  ["$uri", "-cache-id"],
-            "cache_bypass": ["$arg_bypass"],
-            "cache_method": ["GET"],
-            "cache_http_status": [200],
-            "hide_cache_headers": true,
-            "no_cache": ["$arg_test"]
-        }
-    },
-    "upstream": {
-        "nodes": {
-            "127.0.0.1:1999": 1
-        },
-        "type": "roundrobin"
-    },
-    "uri": "/hello"
-}'
-```
+为了清除缓存数据,你只需要指定请求的 method 为 `PURGE`:
 
-```json
-{"error_msg":"failed to check the configuration of plugin proxy-cache err: cache_zone invalid_disk_cache not found"}
+```shell
+curl -i http://127.0.0.1:9080/hello -X PURGE
 ```
 
-响应错误信息,表示插件配置无效。
-
-### 清除缓存数据
-
-如何清理缓存的数据,只需要指定请求的 method 为 PURGE。
-
-测试:
+HTTP 响应码为 `200` 即表示删除成功,如果缓存的数据未找到将返回 `404`:
 
 ```shell
-$ curl -i http://127.0.0.1:9080/hello -X PURGE
 HTTP/1.1 200 OK
-Date: Tue, 03 Mar 2020 11:17:35 GMT
-Content-Type: text/plain
-Transfer-Encoding: chunked
-Connection: keep-alive
-Server: APISIX web server
 ```
 
-> 响应码为 200 即表示删除成功,如果缓存的数据未找到将返回 404。
+:::
 
-再次请求,缓存数据未找到返回 404:
+## 禁用插件
 
-```shell
-$ curl -i http://127.0.0.1:9080/hello -X PURGE
-HTTP/1.1 404 Not Found
-Date: Wed, 18 Nov 2020 05:46:34 GMT
-Content-Type: text/plain
-Transfer-Encoding: chunked
-Connection: keep-alive
-Server: APISIX web server
-
-<html>
-<head><title>404 Not Found</title></head>
-<body>
-<center><h1>404 Not Found</h1></center>
-<hr><center>openresty</center>
-</body>
-</html>
-```
-
-### 禁用插件
-
-移除插件配置中相应的 JSON 配置可立即禁用该插件,无需重启服务:
+当你需要禁用该插件时,可以通过以下命令删除相应的 JSON 配置,APISIX 将会自动重新加载相关配置,无需重启服务:
 
 ```shell
-curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+curl http://127.0.0.1:9180/apisix/admin/routes/1 \
+-H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
     "uri": "/hello",
     "plugins": {},
@@ -291,5 +164,3 @@ curl http://127.0.0.1:9180/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f1
     }
 }'
 ```
-
-这时该插件已被禁用。