Please help me with correct JCS settings.

I'm trying to put()/get() 300000 records. get() returns null. I changed
MaxPurgatorySize. 
Results:
      
MaxPurgatorySize=5000               GET FAILS: 294992
MaxPurgatorySize=10000             GET FAILS: 289999
MaxPurgatorySize=20000             GET FAILS: 279999
MaxPurgatorySize=300000            Exception in thread "main"
java.lang.OutOfMemoryError: 
                                               Java heap space
                                               at
java.lang.Integer.toString(Unknown Source)
                                               at
java.lang.Integer.toString(Unknown Source)
                                               at 
java.lang.String.valueOf(Unknown
Source)
                                               at TestJCS.main(TestJCS.java:21)

CODE:

import org.apache.jcs.JCS;
import org.apache.jcs.access.exception.CacheException;


public class TestJCS
{
    private static JCS cache = null;
    private static int max   = 300000;

    public static void main( String[] args )
    {
        try {
            cache = JCS.getInstance( "myRegion1" );
        } catch ( CacheException e ) {
            e.printStackTrace();
        }

        try {

            for ( int i = 0; i < max; i++ ) {
                cache.put( "id:" + String.valueOf( i ), i );
            }

            for ( int i = max - 1; i >= 0; i-- ) {
                Object o = cache.get( "id:" + String.valueOf( i ) );
                if ( o == null ) {
                    System.out.println( "GET FAILS: " + i );
                    break;
                }
            }
        } catch ( Exception e ) {
            e.printStackTrace();
        }

    }

}


CONFIG

##############################################################
##### Default Region Configuration
jcs.default=DC
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=1000
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache

##############################################################
##### CACHE REGIONS
jcs.region.myRegion1=DC
jcs.region.myRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.myRegion1.cacheattributes.MaxObjects=1000
jcs.region.myRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache

##############################################################
##### AUXILIARY CACHES
# Indexed Disk Cache
jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=c:/cache
jcs.auxiliary.DC.attributes.MaxPurgatorySize=300000
jcs.auxiliary.DC.attributes.MaxKeySize=-1


-- 
View this message in context: 
http://www.nabble.com/MaxPurgatorySize-restricts-get%28%29-from-cache-tp14281150p14281150.html
Sent from the JCS - Users mailing list archive at Nabble.com.


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

Reply via email to