Hi,
I'm trying to fill up a cache, with simple key/values and when I try to
get an existsing key, the cache return null value.
May I done something wrong ?
Thank,
--Christophe
CompositeCacheManager ccm =
CompositeCacheManager.getUnconfiguredInstance();
Properties props = new Properties();
props.load( this.getClass().getResource( "/test/jcs.props"
).openStream() );
ccm.configure(props);
for( int i = 0; i < NB_CACHE; i ++ ) {
String region = "R" + i;
System.out.println( "create region " + region );
ICacheAccess cache = JCS.defineRegion( region );
java.util.Map check = new java.util.HashMap();
for( int j = 1; j < 1000; j++ ) {
String key = "K" + j;
String value = "V" + j;
cache.put( key, value );
check.put( key, value );
}
Thread.sleep( 4000 );
System.out.println( "checking ..." );
for( java.util.Iterator it = check.keySet().iterator() ;
it.hasNext(); ) {
String key = (String) it.next();
Object cache_value = cache.get( key );
Object ref_value = check.get( key );
if( !ref_value.equals( cache_value )) {
throw new Exception (" values are not equals : " + cache_value
+ " " + ref_value );
}
}
}
My config :
# DEFAULT CACHE REGION
##############################################################
##### Default Region Configuration
jcs.default=DC
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut
es
jcs.default.cacheattributes.MaxObjects=100
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory
.lru.LRUMemoryCache
jcs.default.cacheattributes.UseMemoryShrinker=true
jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600
jcs.default.elementattributes.IsEternal=true
jcs.default.elementattributes.IsRemote=false
jcs.default.elementattributes.IsLateral=false
jcs.default.elementattributes.IdleTime=-1
##############################################################
##### AUXILIARY CACHES
# Indexed Disk Cache
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheF
actory
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.Indexe
dDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=d:/prod/discovery/dev_topodisco_1_5
/module/test/swap
jcs.auxiliary.DC.attributes.MaxKeySize=500000
jcs.auxiliary.DC.attributes.MaxPurgatorySize=10
jcs.auxiliary.DC.attributes.OptimizeAtRemoveCount=-1
jcs.auxiliary.DC.attributes.OptimizeOnShutdown=false
jcs.auxiliary.DC.attributes.DiskUsagePattern=UPDATE