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

likeguo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-website.git


The following commit(s) were added to refs/heads/main by this push:
     new da4065580a [type:doc] update shenyu cache and spring cache doc (#941)
da4065580a is described below

commit da4065580a206008268b3f019c46222e8ae8a836
Author: moremind <[email protected]>
AuthorDate: Tue Aug 1 00:02:49 2023 +0800

    [type:doc] update shenyu cache and spring cache doc (#941)
    
    * [type:doc] spring cloud cache doc
    
    * [type:doc] shenyu cache doc
---
 docs/plugin-center/proxy/spring-cloud-plugin.md    | 15 +++++
 .../property-config/gateway-property-config.md     | 77 ++++++++++++++--------
 .../plugin-center/proxy/spring-cloud-plugin.md     | 15 +++++
 .../property-config/gateway-property-config.md     | 74 +++++++++++++--------
 4 files changed, 125 insertions(+), 56 deletions(-)

diff --git a/docs/plugin-center/proxy/spring-cloud-plugin.md 
b/docs/plugin-center/proxy/spring-cloud-plugin.md
index 553d724773..82412c203c 100644
--- a/docs/plugin-center/proxy/spring-cloud-plugin.md
+++ b/docs/plugin-center/proxy/spring-cloud-plugin.md
@@ -215,6 +215,21 @@ Rule Handler, the `handle` field, can be performed by the 
gateway after the fina
   * `path`:request path.
   * `timeout`:set time out.
 
+### 2.5.4 SpringCloud ServiceInstance Cache Config
+
+you can config springcloud serviceInstance cache in `shenyu-bootstrap.yml` as 
follows.
+
+```yaml
+shenyu:
+  springCloudCache:
+    enabled: false
+```
+
+this config will help you get serviceInstance from springcloud registry every 
heartbeat time(listen to spring cloud heartbeat event)
+
+* when you use nacos or eureka as registry, you can config springcloud 
serviceInstance cache to `false`.  
+* when you use zookeeper or consul as registry, you can config springcloud 
serviceInstance cache to `true`.
+
 ## 2.6 Examples
 
 ### 2.6.1 Use ShenYu Request SpringCloud Service
diff --git a/docs/user-guide/property-config/gateway-property-config.md 
b/docs/user-guide/property-config/gateway-property-config.md
index e5970ae6a1..f090e3209e 100644
--- a/docs/user-guide/property-config/gateway-property-config.md
+++ b/docs/user-guide/property-config/gateway-property-config.md
@@ -12,19 +12,28 @@ This paper mainly explains how to configure `Apache ShenYu` 
properties on the ga
 
 ```yaml
 shenyu:
-  matchCache:
-    selector:
-      selectorEnabled: false
+  selectorMatchCache:
+    ## selector L1 cache
+    cache:
+      enabled: false
       initialCapacity: 10000 # initial capacity in cache
       maximumSize: 10000 # max size in cache
-    rule:
+    ## selector L2 cache, use trie as L2 cache
+    trie:
+      enabled: false
+      cacheSize: 128 # the number of plug-ins
+      matchMode: antPathMatch
+  ruleMatchCache:
+    ## rule L1 cache
+    cache:
+      enabled: true
       initialCapacity: 10000 # initial capacity in cache
-      maximumSize: 10000 # max size in cache
-  trie:
-    childrenSize: 10000
-    pathVariableSize: 1000
-    pathRuleCacheSize: 1000
-    matchMode: antPathMatch
+      maximumSize: 65536 # max size in cache
+    ## rule L2 cache, use trie as L2 cache
+    trie:
+      enabled: false
+      cacheSize: 1024 # the number of selectors
+      matchMode: antPathMatch
   netty:
     http:
       webServerFactoryEnabled: true
@@ -211,36 +220,46 @@ shenyu:
 
 ##### shenyu.matchCache config
 
-* selector cache
+* selector match cache
+
+| Field           | Type    | Default | Required | Description                 
      |
+|-----------------|---------|---------|----------|-----------------------------------|
+| enabled         | Boolean | false   | No       | Whether to enable selector 
cache. |
+| initialCapacity | Integer | 10000   | No       | selector initial capacity   
      |
+| maximumSize     | Integer | 10000   | No       | selector max size           
      |
+
+* selector trie cache
+
+| Field        | Type    | Default      | Required | Description               
                                                        |
+|--------------|---------|--------------|----------|-----------------------------------------------------------------------------------|
+| enabled      | Boolean | false        | No       | Whether to enable 
selector trie cache                                             |
+| cacheSize    | Integer | 512          | No       | trie cache size           
                                                        |
+| matchMode    | String  | antPathMatch | Yes      | path match mode, shenyu 
support two match modes, `antPathMatch` and `pathPattern` |
+
 
-| Field           | Type    | Default | Required | Description                 
        |
-|-----------------|---------|---------|----------|-------------------------------------|
-| selectorEnabled | Boolean | false   | No       | Whether to enable selector 
caching. |
-| initialCapacity | Integer | 10000   | No       | selector initial capacity   
        |
-| maximumSize     | Integer | 10000   | No       | selector max size           
        |
+* rule match cache
 
-* rule Level-1 cache config
+| Field           | Type    | Default | Required | Description                 
  |
+|-----------------|---------|---------|----------|-------------------------------|
+| enabled         | Boolean | false   | No       | Whether to enable rule 
cache. |
+| initialCapacity | Integer | 10000   | No       | selector initial capacity   
  |
+| maximumSize     | Integer | 10000   | No       | selector max size           
  |
 
-| Field           | Type    | Default | Required | Description           |
-|-----------------|---------|---------|----------|-----------------------|
-| initialCapacity | Integer | 10000   | Yes      | rule initial capacity |
-| maximumSize     | Integer | 10000   | Yes      | rule max size         |
+* rule trie cache
 
-* shenyu rule Level-2 cache config(shenyu level-2 cache using trie cache)
+| Field        | Type    | Default      | Required | Description               
                                                        |
+|--------------|---------|--------------|----------|-----------------------------------------------------------------------------------|
+| enabled      | Boolean | false        | No       | Whether to enable rule 
trie cache                                                 |
+| cacheSize    | Integer | 512          | No       | trie cache size           
                                                        |
+| matchMode    | String  | antPathMatch | Yes      | path match mode, shenyu 
support two match modes, `antPathMatch` and `pathPattern` |
 
-| Field             | Type    | Default      | Required | Description          
                                                             |
-|-------------------|---------|--------------|----------|-----------------------------------------------------------------------------------|
-| childrenSize      | Integer | 10000        | Yes      | trie cache children 
size                                                          |
-| pathVariableSize  | Integer | 1000         | Yes      | tie cache path 
variable size, for example, /{username}/{age}                      |
-| pathRuleCacheSize | Integer | 1000         | Yes      | rule data list of 
the current path                                                |
-| matchMode         | String  | antPathMatch | Yes      | path match mode, 
shenyu support two match modes, `antPathMatch` and `pathPattern` |
 
-L1 and L2 caching is enabled on shenyu by default,
 shenyu trie match support two match mode, we suggest use `pathPattern` as 
default match mode
 
 > pathPattern: org.springframework.web.util.pattern.PathPatternParser
 > antPathMatch: org.springframework.util.AntPathMatcher
 
+when you mark `matchRestful` as true, we suggest mark all cache to `false` to 
avoid cache conflict.
 
 
 ##### shenyu.NettyTcpProperties config
diff --git 
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/spring-cloud-plugin.md
 
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/spring-cloud-plugin.md
index 88d44f4a96..697d1bdfed 100644
--- 
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/spring-cloud-plugin.md
+++ 
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/spring-cloud-plugin.md
@@ -219,6 +219,21 @@ spring:
   * `path`:请求路径。
   * `timeout`:设置请求超时时间。
 
+### 2.5.4 SpringCloud服务实例缓存配置
+
+你能在`shenyu-bootstrap.yml`文件中修改如下配置:
+
+```yaml
+shenyu:
+  springCloudCache:
+    enabled: false
+```
+
+此配置将帮助您在每次心跳时从springcloud注册中心获取serviceInstance(通过监听springcloud心跳事件)
+
+* 当您使用nacos或者eureka作为注册中心时,您可以将springcloud serviceInstance缓存设置为`false`。
+* 当您使用zookeeper或者consul作为注册中心时,您可以将springcloud serviceInstance缓存设置为`true`。
+
 ## 2.6 示例
 
 ### 2.6.1 使用ShenYu访问SpringCloud服务
diff --git 
a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
 
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
index debdc47a41..1a91909aad 100644
--- 
a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
+++ 
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
@@ -12,19 +12,28 @@ description: 网关属性配置
 
 ```yaml
 shenyu:
-  matchCache:
-    selector:
-      selectorEnabled: false
+  selectorMatchCache:
+    ## selector L1 cache
+    cache:
+      enabled: false
       initialCapacity: 10000 # initial capacity in cache
       maximumSize: 10000 # max size in cache
-    rule:
+    ## selector L2 cache, use trie as L2 cache
+    trie:
+      enabled: false
+      cacheSize: 128 # the number of plug-ins
+      matchMode: antPathMatch
+  ruleMatchCache:
+    ## rule L1 cache
+    cache:
+      enabled: true
       initialCapacity: 10000 # initial capacity in cache
-      maximumSize: 10000 # max size in cache
-  trie:
-    childrenSize: 10000
-    pathVariableSize: 1000
-    pathRuleCacheSize: 1000
-    matchMode: antPathMatch
+      maximumSize: 65536 # max size in cache
+    ## rule L2 cache, use trie as L2 cache
+    trie:
+      enabled: false
+      cacheSize: 1024 # the number of selectors
+      matchMode: antPathMatch
   netty:
     http:
       webServerFactoryEnabled: true
@@ -211,35 +220,46 @@ shenyu:
 
 ##### shenyu.matchCache 配置
 
-* Apache ShenYu 选择器缓存配置
+* 选择器匹配缓存配置
 
 | 字段           | 类型    | 默认值 | 是否必填 | 说明       |
-|-----------------|---------|---------|----------|-------------------|
-| selectorEnabled | Boolean | false   | No       | 是否开启选择器缓存         |
-| initialCapacity | Integer | 10000   | No       | 选择器缓存初始化容量        |
-| maximumSize     | Integer | 10000   | No       | 选择器缓存最大数量         |
+|-----------------|---------|---------|----------|-----------------------------------|
+| enabled         | Boolean | false   | No       | 是否开启选择器缓存 |
+| initialCapacity | Integer | 10000   | No       | 选择器缓存初始化容量         |
+| maximumSize     | Integer | 10000   | No       | 选择器缓存最大数量                 |
+
+* 选择器前缀树缓存配置
+
+| 字段           | 类型    | 默认值 | 是否必填 | 说明                                       
                                         |
+|--------------|---------|--------------|----------|-----------------------------------------------------------------------------------|
+| enabled      | Boolean | false        | No       | 是否开启选择器前缀树缓存              
                                                        |
+| cacheSize    | Integer | 512          | No       | 前缀树缓存大小                   
                                                        |
+| matchMode    | String  | antPathMatch | Yes      | 
shenyu路径匹配模式,shenyu支持两种匹配模式: `antPathMatch` and `pathPattern` |
+
+
+* 规则匹配缓存配置
 
-* Apache ShenYu L1级缓存配置
+| 字段           | 类型    | 默认值 | 是否必填 | 说明        |
+|-----------------|---------|---------|----------|-----------|
+| enabled         | Boolean | false   | No       | 是否开启选择器缓存 |
+| initialCapacity | Integer | 10000   | No       | 规则缓存初始化容量 |
+| maximumSize     | Integer | 10000   | No       | 规则缓存最大数量  |
 
-| 字段              | 类型      | 默认值   | 是否必填 | 说明        |
-|-----------------|---------|-------|------|-----------|
-| initialCapacity | Integer | 10000 | Yes  | 规则缓存初始化容量 |
-| maximumSize     | Integer | 10000 | Yes  | 规则缓存最大容量  |
+* 规则前缀树缓存配置
 
-* Apache ShenYu L2级缓存配置(shenyu使用前缀树作为l2缓存)
+| 字段           | 类型    | 默认值 | 是否必填 | 说明                                       
                     |
+|--------------|---------|--------------|----------|---------------------------------------------------------------|
+| enabled      | Boolean | false        | No       | 是否开启规则前缀树缓存               
                                    |
+| cacheSize    | Integer | 512          | No       | 前缀树缓存大小                   
                                    |
+| matchMode    | String  | antPathMatch | Yes      | 
shenyu路径匹配模式,shenyu支持两种匹配模式: `antPathMatch` and `pathPattern` |
 
-| 字段                | 类型      | 默认值      | 是否必填 | 说明                           
                                 |
-|-------------------|---------|--------------|----------|---------------------------------------------------------------|
-| childrenSize      | Integer | 10000        | Yes      | 前缀树缓存每个子节点的缓存数量      
                                         |
-| pathVariableSize  | Integer | 1000         | Yes      | 前缀树缓存每个子节点存储的路径变量数量, 
/{username}/{age}                        |
-| pathRuleCacheSize | Integer | 1000         | Yes      | 当前路径的规则              
                                         |
-| matchMode         | String  | antPathMatch | Yes      | 
shenyu路径匹配模式,shenyu支持两种匹配模式: `antPathMatch` and `pathPattern` |
 
 shenyu默认开启L1和L2缓存, shenyu前缀树支持两种匹配模式,我们非常建议您使用`pathPattern`作为默认的匹配模式。
 
 > pathPattern: org.springframework.web.util.pattern.PathPatternParser
 > antPathMatch: org.springframework.util.AntPathMatcher
 
+当您将`matchRestful`标记为true时,我们建议将所有缓存标记为`false`,以避免匹配冲突。
 
 
 ##### shenyu.NettyTcpProperties 配置

Reply via email to