Aias00 opened a new issue, #6542: URL: https://github.com/apache/shenyu/issues/6542
## Description The L1 match cache is consulted for a *negative* hit only. When the cache returns a *positive* match (a `SelectorData`/`RuleData` with a non-blank id), the guard `if (Objects.nonNull(selectorData) && StringUtils.isBlank(selectorData.getId()))` is false, so control falls through to `defaultMatchSelector(...)`/`defaultMatchRule(...)` which **unconditionally re-runs the full condition match and overwrites the cached value**. The cached positive match is never used. The code comments at lines 121-123 describe the intended design (L1 cache hit short-circuits). Note the two guards are also inconsistent: the selector uses `StringUtils.isBlank`, the rule uses `Objects.isNull`. ## Location ``` shenyu-plugin-base/.../AbstractShenyuPlugin.java:97-105 (selector), 124-131 (rule) ``` ## Impact The match cache provides zero benefit for the hot/success path — it only works as a negative cache. This defeats the primary purpose of `selectorMatchCache`/`ruleMatchCache` and is the dominant per-request CPU cost on the matching path. ## Suggested fix After the negative-cache guard, add a positive-cache branch: if the cached entry is non-null with a non-blank id, use it directly. Apply symmetrically to selector and rule. ## Related existing issue(s) #5290 (closed) was about a match error, not positive-hit discard; #5044 (closed) was a cache-enhancement task. Not a dup. _Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._ -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
