You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/02 09:40:03 UTC

[GitHub] [apisix] zaunist commented on a change in pull request #5984: feat(limit-count): add constant key type

zaunist commented on a change in pull request #5984:
URL: https://github.com/apache/apisix/pull/5984#discussion_r777187158



##########
File path: docs/zh/latest/plugins/limit-count.md
##########
@@ -161,6 +161,35 @@ HTTP/1.1 503 ...
 注意同一个 group 里面的 limit-count 配置必须一样。
 所以,一旦修改了配置,我们需要更新对应的 group 的值。
 
+我们也支持在所有请求间共享同一个限流计数器。举个例子,
+
+```shell
+curl -i http://127.0.0.1:9080/apisix/admin/services/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "plugins": {
+        "limit-count": {
+            "count": 1,
+            "time_window": 60,
+            "rejected_code": 503,
+            "key": "remote_addr",
+            "key_type": "constant",
+            "group": "services_1#1640140621"
+        }
+    },
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    }
+}'
+```
+
+比起之前的配置,我们把 `key_type` 改成 `constant`。

Review comment:
       ```suggestion
   在上面的例子中,我们将 `key_type` 设置为 `constant`。
   ```

##########
File path: docs/zh/latest/plugins/limit-count.md
##########
@@ -161,6 +161,35 @@ HTTP/1.1 503 ...
 注意同一个 group 里面的 limit-count 配置必须一样。
 所以,一旦修改了配置,我们需要更新对应的 group 的值。
 
+我们也支持在所有请求间共享同一个限流计数器。举个例子,
+
+```shell
+curl -i http://127.0.0.1:9080/apisix/admin/services/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "plugins": {
+        "limit-count": {
+            "count": 1,
+            "time_window": 60,
+            "rejected_code": 503,
+            "key": "remote_addr",
+            "key_type": "constant",
+            "group": "services_1#1640140621"
+        }
+    },
+    "upstream": {
+        "type": "roundrobin",
+        "nodes": {
+            "127.0.0.1:1980": 1
+        }
+    }
+}'
+```
+
+比起之前的配置,我们把 `key_type` 改成 `constant`。

Review comment:
       Would be better ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org