Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
Open Source
>
Development Lib
>
Common Toolkit
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
17
Star
205
Fork
32
opengoofy
/
crane4j
Code
Issues
2
Pull Requests
0
Wiki
Insights
Pipelines
Service
JavaDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
方法缓存希望可以像 Spring 那样,通过注解配置到期时间和刷新
Done
#I8UZSO
Createsequence
owner
Opened this issue
2024-01-10 11:18
现有的缓存机制并不完善: - `CacheManager` 机制不够灵活,会强制限定死整个服务的缓存源。 - `@ContainerCache` 注解无法指定到期时间,实际上整个缓存机制都缺乏细粒度的到期管理。 - `CacheManager` 与 `CacheableContainer` 之间的交互方式比较别扭。 - `@ContainerCache` 只支持方法容器,而不支持通过自定义容器。 理想的缓存机制应当如下: ~~~java @ContainerCache( expire = 60L, // 指定到期时间 timeUnit = TimeUnit.SECEND, // 指定到期时间单位 cacheFactory = "redisCacheFactory" // 指定缓存工厂,此处应当可选 redis、guava、ehcache 与本地缓存 ) @Component public class FooContainer implements Container<String> { // ... ... } ~~~ 并且,除了自动到期外,需要在 `CacheManager` 或者 `CacheFactory` 那边提供一个主动过期的 API,比如: ~~~java CacheManager manager = // 从上下文获取全局管理器 manager.removeChace("name"); // 此处的 name 为缓存名称,或者容器的名称 ~~~
现有的缓存机制并不完善: - `CacheManager` 机制不够灵活,会强制限定死整个服务的缓存源。 - `@ContainerCache` 注解无法指定到期时间,实际上整个缓存机制都缺乏细粒度的到期管理。 - `CacheManager` 与 `CacheableContainer` 之间的交互方式比较别扭。 - `@ContainerCache` 只支持方法容器,而不支持通过自定义容器。 理想的缓存机制应当如下: ~~~java @ContainerCache( expire = 60L, // 指定到期时间 timeUnit = TimeUnit.SECEND, // 指定到期时间单位 cacheFactory = "redisCacheFactory" // 指定缓存工厂,此处应当可选 redis、guava、ehcache 与本地缓存 ) @Component public class FooContainer implements Container<String> { // ... ... } ~~~ 并且,除了自动到期外,需要在 `CacheManager` 或者 `CacheFactory` 那边提供一个主动过期的 API,比如: ~~~java CacheManager manager = // 从上下文获取全局管理器 manager.removeChace("name"); // 此处的 name 为缓存名称,或者容器的名称 ~~~
Comments (
1
)
Sign in
to comment
Status
Done
Backlog
Doing
Done
Closed
Assignees
Not set
Createsequence
CreateSequence
Assignee
Collaborator
+Assign
+Mention
Labels
enhancement
Not set
Label settings
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (
-
)
Tags (
-
)
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
参与者(1)
Java
1
https://gitee.com/opengoofy/crane4j.git
git@gitee.com:opengoofy/crane4j.git
opengoofy
crane4j
crane4j
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register