-
-
Notifications
You must be signed in to change notification settings - Fork 364
feat(CacheManagerOptions): add CacheManagerOptions support configue cache expiration #5310
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
Conversation
Reviewer's Guide by SourceryThis pull request introduces CacheManagerOptions to configure cache expiration times, allowing for more flexible control over cache behavior. Sequence diagram for cache entry creation with new expiration settingssequenceDiagram
participant Client
participant CacheManager
participant Cache
participant Options
Client->>CacheManager: GetOrCreate(key, factory)
activate CacheManager
CacheManager->>Cache: Create cache entry
activate Cache
Cache-->>CacheManager: Return entry
deactivate Cache
CacheManager->>Options: Get CacheManagerOptions
activate Options
Options-->>CacheManager: Return options
deactivate Options
alt No expiration set
CacheManager->>Cache: Set sliding expiration from options
end
CacheManager-->>Client: Return cached item
deactivate CacheManager
Class diagram showing CacheManagerOptions integrationclassDiagram
class BootstrapBlazorOptions {
+TableSettings TableSettings
+StepSettings StepSettings
+ConnectionHubOptions ConnectionHubOptions
+WebClientOptions WebClientOptions
+IpLocatorOptions IpLocatorOptions
+ScrollOptions ScrollOptions
+ContextMenuOptions ContextMenuOptions
+CacheManagerOptions CacheManagerOptions
}
class CacheManagerOptions {
+bool Enable
+TimeSpan SlidingExpiration
+TimeSpan AbsoluteExpiration
}
class CacheManager {
-IServiceProvider Provider
-IMemoryCache Cache
-static CacheManager Instance
-static BootstrapBlazorOptions Options
+GetOrCreate<TItem>(object key, Func factory)
+GetOrCreateAsync<TItem>(object key, Func factory)
}
BootstrapBlazorOptions *-- CacheManagerOptions
CacheManager --> BootstrapBlazorOptions : uses
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- In ICacheEntryExtensions, consider revising the 'Expirated' string to 'Expired' for clarity in expiration messages.
- Before applying cache expiration settings in GetOrCreate methods, consider checking if CacheManagerOptions.Enable is true to ensure that the expiration configuration is applied only when intended.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟡 Security: 1 issue found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5310 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 643 644 +1
Lines 28906 28918 +12
Branches 4109 4110 +1
=========================================
+ Hits 28906 28918 +12 ☔ View full report in Codecov by Sentry. |
add CacheManagerOptions support configue cache expiration
Summary of the changes (Less than 80 chars)
简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号
Description
fixes #5309
Regression?
[If yes, specify the version the behavior has regressed from]
[是否影响老版本]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add support for configuring cache expiration using CacheManagerOptions.
New Features:
CacheManagerOptionsto control cache expiration settings, including sliding and absolute expiration times.Tests:
CacheManagerOptions.