Skip to content

Refactor Selector#6336

Open
2823602869 wants to merge 4 commits intoapache:masterfrom
2823602869:Refactor-Selector
Open

Refactor Selector#6336
2823602869 wants to merge 4 commits intoapache:masterfrom
2823602869:Refactor-Selector

Conversation

@2823602869
Copy link
Copy Markdown
Contributor

Refactor Selector #6290

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

@2823602869 2823602869 marked this pull request as ready for review April 30, 2026 10:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors selector/rule matching in AbstractShenyuPlugin to properly leverage the existing two-level match cache (L1 WindowTinyLFU + L2 matching strategy), and adds targeted tests to cover L1 cache-hit behavior.

Changes:

  • Fix selector/rule execution flow to return immediately on L1 cache hits (including cached negative-match sentinels).
  • Refactor match-caching logic via a shared cacheMatchData(...) helper and minor hot-path optimizations in matching.
  • Add unit tests validating L1 cache-hit and negative-sentinel short-circuit behavior for both selector and rule matching.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
shenyu-plugin/shenyu-plugin-base/src/main/java/org/apache/shenyu/plugin/base/AbstractShenyuPlugin.java Refactors selector/rule lookup to correctly use L1 cache hits and consolidates match-caching logic.
shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/AbstractShenyuPluginTest.java Adds tests covering selector/rule L1 cache hits and negative-sentinel short-circuit cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants