Closed dzlab closed 10 years ago
On the first point, while I think that's the way it should be, I guess it could make some sense as a feature request. But let me ask what you would have expected there? I'm thinking that capacity should be read from the defaultCache
config basically. Mainly due to the lack of support for configuration that through the JSR107 API. Anything else you had in mind?
On the second point, not sure what you see as a problem there. The behavior you see is the one spec'ed:
* If a {@link Cache} with the specified name is known to the {@link
* CacheManager}, a CacheException is thrown.
Now, what might be unclear, is that when you source your CacheManager
from a an ehcache.xml
, all Cache
instances declared in there will be created for you automatically...
For the first point, I'm expecting the capacity to be read from defaultCache
when it's provided in the ehcache.xml
because otherwise how I could create new cache instances with a default configuration that I can control.
For the second point, I agree, in fact I tried to create a cache with a name already in ehcache.xml
to check if this xml file is really used. But it also makes me wondering why the created caches (i.e. with names not declared in the xml file) are not using the default configuration.
With regards to your "feature request" in using defaultCache
to seed capacity of programmatically created javax.cache.Cache
instances, I've created issue #32.
The other points I clear, and stem from confusing naming in Ehcache... And JSR107 lack of "CacheManager.addCache(String)", i.e. w/o explicit Configuration
I have the following default configuration that I want to be applied to all caches created by
CacheManager.createCache()
. Here is myehcache.xml
:I try to create the cache as follows:
But it seems the default cache configuration is not used as when debugging the cache has the following attributes:
Also, When I declare a named cache in
ehcache.xml
and give the same name toCacheManager.createCache()
I get ajavax.cache.CacheException at org.ehcache.jcache.JCacheManager.createCache(JCacheManager.java:106)