Search code examples
javaehcacheehcache-3

How do I get a list of cache names in Ehcache 3


In Ehcache 2 I used

Cache<String, Release> releaseCache = cacheManager.getCacheNames();

But in Ehcache 3 although I have a CacheManager the getCacheNames() method does not exist.


Solution

  • Yes indeed. It does not exist. You have these solutions:

    1. Do harsh reflection to get access to EhCacheManager.caches
    2. Use JSR-107 CacheManager.getCacheNames