Skip to content

fix: Groovy 脚本缓存增加跨实例失效同步与可插拔缓存策略 (8.x/springboot-starter-script) - #221

Merged
xlorne merged 1 commit into
8.2.xfrom
feature/issue-214-groovy-cache-sync-8x
Nov 10, 2026
Merged

xlorne merged 1 commit into
8.2.xfrom
feature/issue-214-groovy-cache-sync-8x

Conversation

@xlorne

@xlorne xlorne commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

同步 17.x 的 issue #214 修复,按 JDK 8 做代际适配:

  • 新增 GroovyScriptCacheEvent(ISyncEvent):脚本保存/删除后经 EventPusher 进程内分发,业务可通过 IHandler 监听脚本变更
  • 新增 GroovyScriptCacheSync SPI(默认 LocalGroovyScriptCacheSync):多实例部署时可接入 Redis pub/sub 等实现跨实例广播,远端实例 receive 后失效本地缓存并回源仓储
  • 新增 GroovyScriptCache 缓存容器接口与 DefaultGroovyScriptCache:LRU 容器抽象为可替换策略,支持 Redis 等共享缓存实现
  • GroovyScript.save()/remove() 写路径发布缓存变更事件;GroovyScriptCacheContext.remove 改为纯本地失效
  • 能力文档补充多实例部署章节与 Redis 实现方案示例

Ref #214

Describe what this PR does / why we need it

Does this pull request fix one issue?

Describe how you did it

Describe how to verify it

Special notes for reviews

同步 17.x 的 issue #214 修复,按 JDK 8 做代际适配:
- 新增 GroovyScriptCacheEvent(ISyncEvent):脚本保存/删除后经 EventPusher 进程内分发,业务可通过 IHandler 监听脚本变更
- 新增 GroovyScriptCacheSync SPI(默认 LocalGroovyScriptCacheSync):多实例部署时可接入 Redis pub/sub 等实现跨实例广播,远端实例 receive 后失效本地缓存并回源仓储
- 新增 GroovyScriptCache 缓存容器接口与 DefaultGroovyScriptCache:LRU 容器抽象为可替换策略,支持 Redis 等共享缓存实现
- GroovyScript.save()/remove() 写路径发布缓存变更事件;GroovyScriptCacheContext.remove 改为纯本地失效
- 能力文档补充多实例部署章节与 Redis 实现方案示例

Ref #214
@xlorne
xlorne merged commit 0595d15 into 8.2.x Nov 10, 2026
1 check passed
@xlorne
xlorne deleted the feature/issue-214-groovy-cache-sync-8x branch November 10, 2026 11:42
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.36620% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.20%. Comparing base (85f3849) to head (679874a).
⚠️ Report is 2 commits behind head on 8.2.x.

Files with missing lines Patch % Lines
...oot/script/cache/GroovyScriptCacheSyncContext.java 88.23% 1 Missing and 1 partial ⚠️
...ingboot/script/cache/GroovyScriptCacheContext.java 92.85% 0 Missing and 1 partial ⚠️
...pringboot/script/cache/GroovyScriptCacheEvent.java 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              8.2.x     #221      +/-   ##
============================================
+ Coverage     87.17%   87.20%   +0.03%     
- Complexity     2329     2357      +28     
============================================
  Files           213      217       +4     
  Lines          6120     6176      +56     
  Branches        411      411              
============================================
+ Hits           5335     5386      +51     
- Misses          641      643       +2     
- Partials        144      147       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant