It looks like JCache (commons-jcs) is creating a default cache even though I
use:

@CacheDefaults(cacheName = "testCache", cacheKeyGenerator
        = StringKeyGenerator.class)

Even if I use:

        cacheManager = cachingProvider.getCacheManager(new File(
                "src/main/resources/jcache.ccf").toURI(),
                Thread.currentThread().getContextClassLoader(),
cachingProvider.
                getDefaultProperties());
        MutableConfiguration<StringGeneratedCacheKey, String> config
                = new MutableConfiguration<>();
        config.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(
                new Duration(TimeUnit.MINUTES, 10)));
        cache = cacheManager.createCache("testCache", config);

In the logs I see both caches being created:

Using getCacheManager:

INFO: initialized MemoryCache for testCache
Sep 14, 2015 1:07:58 PM org.apache.commons.jcs.engine.control.CompositeCache
<init>
INFO: Constructed cache with name [testCache] and cache attributes [
useLateral = true, useRemote = true, useDisk = true, maxObjs = 200001,
maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]
Sep 14, 2015 1:07:58 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseAuxiliary
SEVERE: Could not instantiate auxFactory named "DC".
Sep 14, 2015 1:07:58 PM
org.apache.commons.jcs.engine.control.CompositeCacheConfigurator
parseRegions
INFO: Parsed regions [testCache]

Then the default version:

INFO: initialized MemoryCache for testCache
Sep 14, 2015 1:07:58 PM org.apache.commons.jcs.engine.control.CompositeCache
<init>
INFO: Constructed cache with name [testCache] and cache attributes [
useLateral = true, useRemote = true, useDisk = true, maxObjs = 100,
maxSpoolPerRun = -1, diskUsagePattern = SWAP, spoolChunkSize = 2 ]

The annotations are using athe default configuration.




--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/JCache-annotations-using-default-cache-instead-of-MutableConfiguration-or-configuration-file-tp4676198.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to