Unable to pass XML configuration via JCache's "getCacheManager" #91
Comments
To get the default cache manager, do:
or
or simply, if you don't need to specify properties or classloader:
In case there is a If you want to create a different cache manager, with a different configuration, then do:
In this case Background: There is a conceptual mismatch between the cache manager designation in cache2k and JCache. In JCache it is an URI of the configuration file, which is probably an inheritance from Gregs' EHcache. In cache2k a cache manager simply has a name, which is a string. The reason is that I'd like the cache2k API to be open and not tied to specific concepts. The XML configuration is one way that the cache configuration is provided, but its possible to provide other mechanisms to provide the cache configuration via the service provider interface The second reason is that I don't like an URI like I think many first time users will probably stumble here, so I try to improve documentation and the exception. In case there are any limitations from other frameworks that require the URI to include a scheme and/or path, please let me know. |
I added some remarks in the documentation and improved the exception messge and just released the version Just let me know in case you hit another obstacle. I am happy to assist. |
When using the JCache interface, I'm unable to configure the Cache2K provider at runtime using an XML configuration via
getCacheManager(URI configURI, ClassLoader classLoader)
.I receive the following exception when I attempt this:
The culprit appears to be the
JCacheProvider::getCacheManager
using the URI to generate a unique cache name, however theuri2name()
method it uses only performs atoString()
on theURI
which creates the string "protocol:path" and thus the illegal character ':' ends up in the name.As getCacheManager(...) only accepts URIs, I do not see a way around this.
The text was updated successfully, but these errors were encountered: