I believe it's preferred to use the JCS interface:
        org.apache.jcs.JCS jcs = org.apache.jcs.JCS.getInstance("region");
        Object value = new Integer(1);
        jcs.put("key", value);
        value = jcs.get("key");

Hope that helps,
Dennis

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, March 23, 2007 7:43 AM
To: jcs-users@jakarta.apache.org
Subject: [bayes][heur][faked-from] get method return null for existing
key



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.CompositeCacheAttributes
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.IndexedDiskCacheFacto
ry
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDis
kCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=d:/prod/discovery/dev_topodisco_1_5/mod
ule/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




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to