-
Notifications
You must be signed in to change notification settings - Fork 55
feat: 支持缓存 --story=128800655 #1118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: 支持缓存 --story=128800655 #1118
Conversation
There was a problem hiding this 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 adds comprehensive caching support to the unify-query service, implementing a distributed singleflight pattern to prevent redundant queries across multiple service instances. The implementation uses a two-tier caching strategy with Ristretto for local in-memory caching and Redis for distributed coordination and storage.
Key changes:
- New cache service with distributed singleflight pattern using Redis pub/sub
- HTTP cache middleware to intercept and cache API responses
- Global cache initialization and lifecycle management
Reviewed changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/unify-query/cache/cache.go | Core cache service implementing distributed singleflight with Redis pub/sub and Ristretto local cache |
| pkg/unify-query/cache/manager.go | Global cache singleton management with initialization and cleanup |
| pkg/unify-query/cache/cache_test.go | Test for distributed singleflight behavior across nodes |
| pkg/unify-query/service/http/middleware/cache.go | HTTP middleware for request/response caching with configurable paths and methods |
| pkg/unify-query/service/http/middleware/cache_test.go | Test for cache middleware with concurrent requests |
| pkg/unify-query/service/http/service.go | Integration of cache middleware into HTTP service |
| pkg/unify-query/cmd/root.go | Cache initialization at application startup and cleanup at shutdown |
| pkg/unify-query/go.mod | Moved unused dependencies to indirect, updated Go version to 1.21.0 |
| pkg/unify-query/go.sum | Updated dependency versions |
| pkg/sliwebhook/go.mod | Updated Go version to 1.21.0 |
| pkg/influxdb-proxy/go.mod | Updated Go version to 1.21.0 and dependency versions |
| pkg/bkmonitorbeat/go.mod | Updated dependency versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- 添加缓存服务支持 - 添加Redis相关配置和路由 - 实现HTTP中间件缓存功能 - 添加缓存相关测试用例
52d08e2 to
3ff7851
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 19 out of 22 changed files in this pull request and generated 19 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 16 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.