2

One of my requirements requires to see how much data i have cached

I would like to see what data is cached in Spring.

Is there any way i can see what Spring cached? key and values

1 Answers1

4

Well if you have a handle on the CacheManager

http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/cache/CacheManager.html

it has a method:

getCache(String name)

which returns a:

http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/cache/Cache.html

which has a method:

getNativeCache();

which you should then be able to query.

Alan Hay
  • 22,665
  • 4
  • 56
  • 110