Hi,
got a question regarding tomee/jcs/jcache
@Produces
@WebCache
@ApplicationScoped
public CacheManager createManager() {
System.out.println("Producing cache.......");
try {
URI uri =
this.getClass().getClassLoader().getResource("cache.ccf").toURI();
CachingProvider cachingProvider = Caching.getCachingProvider();
return cachingProvider.getCacheManager(uri,
Thread.currentThread().getContextClassLoader(),
cachingProvider.getDefaultProperties());
} catch (URISyntaxException ex) {
System.out.println("USING DEFAULT CACHE MANAGER.......");
return Caching.getCachingProvider().getCacheManager();
}
}
@Produces
@WebCacheType(CacheType.WEB)
@ApplicationScoped
public Cache createCache(@WebCache CacheManager manager) {
return manager.createCache(
"person_cache",
new MutableConfiguration()
.setStoreByValue(false)
.setStatisticsEnabled(true)
.setManagementEnabled(true)
.setExpiryPolicyFactory(AccessedExpiryPolicy.factoryOf(new
Duration(TimeUnit.SECONDS, 3600L))));
}
If I'm right, it will be evicted from cache if not accessed in an hour?
in tomee 1.7.1 right now its only in cache for a few milliseconds...
this is my cache.ccf:
jcs.default=DC
jcs.default.cacheattributes=org.apache.commons.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=200001
jcs.default.cacheattributes.MemoryCacheName=org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.cacheattributes.UseMemoryShrinker=true
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.default.cacheattributes.ShrinkerIntervalSeconds=60
jcs.default.elementattributes=org.apache.commons.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.MaxLife=700
jcs.default.elementattributes.IdleTime=1800
jcs.default.elementattributes.IsSpool=true
jcs.default.elementattributes.IsRemote=true
jcs.default.elementattributes.IsLateral=true
However, using
return Caching.getCachingProvider().getCacheManager();
in CM producer, it's working OK.
Am I doing something wrong here?
br hw
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/tomee-jcache-question-tp4673495.html
Sent from the TomEE Users mailing list archive at Nabble.com.