Spring 框架中是否有一种与提供者无关的方法来获取最新的缓存统计信息?

发布于 2024-10-22 03:14:05 字数 508 浏览 10 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆光飞翔i 2024-10-29 03:14:05

唯一常见的、与提供者无关的东西是 CacheManager 接口,它提供以下方法:

Collection<String> getCacheNames() 

它返回缓存管理器已知的缓存集合。

The only common, provider-agnostic thing you have is CacheManager interface, which provides the following method:

Collection<String> getCacheNames() 

It returns a collection of the caches known by the cache manager.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文