Skip to content
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

时隔四年,对《Caffeine CacheManager 如何查看命中率、监控》提出一些新的处理方式建议 #3

Open
houkunlin opened this issue Aug 4, 2024 · 0 comments

Comments

@houkunlin
Copy link

## 4、重写吧(x_x)

新方式已核实确实有用,可对全局生效,且不用增加任何Java代码,那就是修改配置文件

spring:
  cache:
    cache-names: default
    caffeine:
      spec: maximumSize=500,expireAfterWrite=5s,recordStats
    type: caffeine

周六我在开发后台管理系统的时候,想开发一个缓存清理功能,一开始写的时候没想到要加入监控数据,但是在 debug 的时候发现有个 com.github.benmanes.caffeine.cache.Cache.stats() 方法可以获取缓存监控信息,然后就高高兴兴的加入进去了,接口功能都写好后最后发现统计数据没生效,一顿操作猛如虎,终于给我找到了方法

https://blog.houkunlin.cn/2024/08/04/spring-caffeine-cache-manager-stats-enable/

https://github.com/houkunlin/houkunlin.github.io/blob/master/source/_posts/2024-08-04-spring-caffeine-cache-manager-stats-enable.md

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

No branches or pull requests

1 participant