Spring 框架中是否有一种与提供者无关的方法来获取最新的缓存统计信息?
Spring 提供了一个有用的功能 缓存抽象
但我找不到一种与提供商无关的方式来获取实时缓存统计信息。本质上,我只想在网页上或通过 JMX 显示所有缓存名称及其相应键的列表,以及命中、未命中和大小(以 kb 为单位)的计数。我知道 Ehcache 确实提供了此功能,如果我使用 ehcache API 在代码中我可以得到它(过去已经使用过它)。但我相信在代码中使用 Ehcache API 会消除 Spring 框架缓存抽象的整个概念。
Spring provides a useful feature of Cache Abstraction
But what I could not find is a provider agnostic way to get live cache statistics. Essentially I just want to show a list of all the cache names and their corresponding keys with the count of hits, misses, and sizes (in kb) either on a web page or via JMX. I know Ehcache does provide this feature and if I use ehcache API inside the code I can get it (have already used it in the past). But I believe using Ehcache API inside the code takes away the whole notion of the Spring framework's cache abstraction.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
唯一常见的、与提供者无关的东西是 CacheManager 接口,它提供以下方法:
它返回缓存管理器已知的缓存集合。
The only common, provider-agnostic thing you have is
CacheManager
interface, which provides the following method:It returns a collection of the caches known by the cache manager.