Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CachingProvider.getCacheManagers() #409

Open
evernat opened this issue Sep 17, 2019 · 4 comments
Open

add CachingProvider.getCacheManagers() #409

evernat opened this issue Sep 17, 2019 · 4 comments
Milestone

Comments

@evernat
Copy link

evernat commented Sep 17, 2019

There are methods Caching.getCachingProvider(String) and Caching.getCachingProviders().
There are methods CacheManager.getCache(String) and CacheManager.getCacheNames().
There is also a method CachingProvider.getCacheManager(URI, ClassLoader, Properties).
But there is currently no method CachingProvider.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() in CachingProvider 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.

@eolivelli
Copy link

Is it expected that a CachingProvider holds a reference to every CacheManager?

@eolivelli
Copy link

Self answer: yes

I think it is feasible

+1

@cruftex
Copy link
Member

cruftex commented Oct 8, 2019

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.

@cruftex cruftex added this to the 2.0 milestone Oct 8, 2019
@hjsarrive
Copy link

its will bigger if we add a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants