Open evernat opened 4 years ago
Is it expected that a CachingProvider holds a reference to every CacheManager?
Self answer: yes
I think it is feasible
+1
So there is no way in the JCache api to discover which cacheManagers have been created with URIs. I suggest to add a method getCacheManagers() in CachingProvider to return all known cacheManagers in the cachingProvider whatever URIs were used.
There is no programmatic API, but you can discover all caches via JMX and clear them.
We cannot add the method in a maintenance release, since this would break compatibility. But for a next major release it seams reasonable to add it.
its will bigger if we add a lot
There are methods
Caching.getCachingProvider(String)
andCaching.getCachingProviders()
. There are methodsCacheManager.getCache(String)
andCacheManager.getCacheNames()
. There is also a methodCachingProvider.getCacheManager(URI, ClassLoader, Properties)
. But there is currently no methodCachingProvider.getCacheManagers()
.So there is no way in the JCache api to discover which cacheManagers have been created with URIs. I suggest to add a method
getCacheManagers()
inCachingProvider
to return all known cacheManagers in the cachingProvider whatever URIs were used.It would be needed to be able to clear all caches of all cacheManagers, after a database synchronisation for example, without having to depend on which URIs were used. This method
CachingProvider.getCacheManagers()
would be useful for many other things.