插件说明与使用介绍 如何启用 在配置窗口页以YAML 格式填写 配置示例 下面是一个示例,开启proxycache 插件,并配置了一些属性。表示对于路径为“/hello”的路由,在60秒内,对于返回结果为200的GET请求将返回缓存结果,其中缓存的key为请求uri+"cacheid"的拼接字符串。 curl H 'XAPIKEY: edd1c9f034335f136f87ad84b625c8f1' X PUT d ' { "plugins": { "proxycache": { "cachekey": ["$uri", "cacheid"], "cachebypass": ["$argbypass"], "cachemethod": ["GET"], "cachehttpstatus": [200], "hidecacheheaders": true, "cachecontrol": false, "cachettl": 60 } }, "upstream": { "nodes": { "127.0.0.1:1999": 1 }, "type": "roundrobin" }, "uri": "/hello" }' 启用/停用 在路由上绑定/解绑插件 验证插件 在路由上绑定结果缓存插件后,第一次请求ApisixCacheStatus状态为MISS $curl i 127.0.0.1:27151/api/1/reviews HTTP/1.1 200 ContentType: application/json TransferEncoding: chunked Connection: keepalive ApisixCacheStatus: MISS Date: Mon, 18 Mar 2024 12:02:07 GMT Server: APISIX/2.13.3 [{"id":1,"productId":1,"reviewer":"Reviewer1","text":"This is the 1st reviewer"}] 再次请求,命中缓存,ApisixCacheStatus状态为HIT $ curl i 127.0.0.1:27151/api/1/reviews HTTP/1.1 200 OK ContentType: application/json TransferEncoding: chunked Connection: keepalive Date: Mon, 18 Mar 2024 12:02:07 GMT Server: APISIX/2.13.3 Age: 3 ApisixCacheStatus: HIT [{"id":1,"productId":1,"reviewer":"Reviewer1","text":"This is the 1st reviewer"}] 安全限制类