In the grails application, I want to display all the current second level cache entries from all regions .
My code is as follows:
def getCacheStats() { StatisticsImpl stats = sessionFactory.statistics for (regionName in stats.secondLevelCacheRegionNames) { log.debug stats.getSecondLevelCacheStatistics(regionName).entries } }
However, everything works fine until the domain name is org.hibernate.cache.StandardQueryCache (the region is used for Query Cache ). In this case, an exception is thrown:
java.lang.ClassCastException: org.hibernate.cache.QueryKey cannot be cast to org.hibernate.cache.CacheKey
After a google search, I did not find any tips on how to display a list of cached query result set entries related to the StandardQueryCache and UpdateTimestampsCache .
Could you help me find a solution to this?
source share