0

I want to get the details of entries in my custom cache after caching data or eviction of data.

I tried using actuator dependency to get 'actuator/metrics' path to get details but I'm getting empty tomcat server cache. There is no sign of my custom cache say myCache (the name which I passed into @Cacheable annotation value argument).

Devender Kumar
  • 107
  • 1
  • 12

1 Answers1

0

You tagged your question with Caffeine and Spring Boot, so I assume you use those two products.

If you use a recent Spring Boot and Caffeine, statistics will be automatically available at actuator/caches. If not, double check you have the needed libraries on your classpath and no configuration that enables another cache or disables caching at all, like spring.cache.type=none.

If you don't use Spring Boot, but just Spring, you need to add a CacheManager to your configuration, otherwise Spring defaults to the ConcurrentHashMap which does not have cache statistics.

cruftex
  • 5,545
  • 2
  • 20
  • 36
  • `actuator/caches` giving 404 error and yes I'm using springboot with caffeine. I have also created a custom caffeine cache manager to deal with different caches. @cruftex – Devender Kumar Aug 29 '19 at 04:57
  • @DevenderKumar, nobody can help further without knowing your actual code or configuration. You could extend your question with code snippets or put up a github project with a minimal example. – cruftex Aug 29 '19 at 05:36
  • Thanks for answering @cruftex , `actuator/metrics/cache.size` is working in my case and I'm getting cache size. The problem is solved. – Devender Kumar Aug 29 '19 at 06:11