【问题标题】:Spring Cacheable measure hit/miss with AspectJSpring Cacheable measure hit/miss with AspectJ
【发布时间】:2017-03-06 23:57:55
【问题描述】:

我正在使用 Spring Cache 框架进行缓存,并使用 AspectJ 来帮助测量有关我的应用程序的统计信息。我想知道如何使用 AspectJ 来确定 @Cacheable 何时从缓存中检索结果?

【问题讨论】:

  • 我认为分享minimal, complete, and verifiable example 描述您的情况,当前与预期行为是有益的。到目前为止,您对 Spring AOP 或 AspectJ 进行了哪些尝试?你有哪些困难?

标签: spring aspectj spring-cache


【解决方案1】:

我相信从 2.7 版本开始默认启用 Ehcache 的统计信息。统计信息通过 jmx 公开。这是 javadoc 声明相同:http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/cache/ehcache/EhCacheFactoryBean.html#setSampledStatisticsEnabled-boolean-

【讨论】:

  • 在调用方法时没有其他方法可以获取吗?就像调用 Cacheable 的方法一样,我可以知道它是否从缓存中检索元素。
猜你喜欢
  • 2015-12-17
  • 1970-01-01
  • 2019-05-30
  • 1970-01-01
  • 1970-01-01
  • 2016-02-26
  • 1970-01-01
  • 1970-01-01
  • 2020-05-14
相关资源
最近更新 更多