Package org.apache.jcs.engine.behavior

Examples of org.apache.jcs.engine.behavior.ICacheElement


        LateralTCPService service = new LateralTCPService( lattr2 );
        service.setListenerId( 123456 );

        String keyToBeRemovedOnPut = "test1_notremoved";

        ICacheElement element1 = new CacheElement( region, keyToBeRemovedOnPut, region
            + ":data-this shouldn't get removed, it should get to the cache." );
        service.update( element1 );

        Thread.sleep( 1000 );
View Full Code Here


        service.setListenerId( 123456 );

        String keyToBeRemovedOnPut = "test1";
        cache.put( keyToBeRemovedOnPut, "this should get removed." );

        ICacheElement element1 = new CacheElement( region, keyToBeRemovedOnPut, region
            + ":data-this shouldn't get there" );
        service.update( element1 );

        try
        {
            for ( int i = 1; i < numOps; i++ )
            {
                Random ran = new Random( i );
                int n = ran.nextInt( 4 );
                int kn = ran.nextInt( range );
                String key = "key" + kn;

                ICacheElement element = new CacheElement( region, key, region + ":data" + i
                    + " junk asdfffffffadfasdfasf " + kn + ":" + n );
                service.update( element );
                if ( show )
                {
                    p( "put " + key );
View Full Code Here

        int max = cache.getCacheAttributes().getMaxObjects();
        int items = max / 2;

        for ( int i = 0; i < items; i++ )
        {
            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
            ice.setElementAttributes( cache.getElementAttributes() );
            arc.update( ice );
        }

        System.out.println( "testGetKeyArray " + arc.getStats() );
View Full Code Here

        int max = cache.getCacheAttributes().getMaxObjects();
        int items = max / 2;

        for ( int i = 0; i < items; i++ )
        {
            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
            ice.setElementAttributes( cache.getElementAttributes() );
            arc.update( ice );
        }

        ICacheElement element = arc.get( 0 + ":key" );

        System.out.println( "testHitInT1BelowMax " + arc.getStats() );

        assertNotNull( "Should have the element.", element );
        assertEquals( "Target t1 should be 1/2 until dupe gets or puts.", max / 2, arc.getTarget_T1() );
View Full Code Here

        int max = cache.getCacheAttributes().getMaxObjects();
        int items = max / 2;

        for ( int i = 0; i < items; i++ )
        {
            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
            ice.setElementAttributes( cache.getElementAttributes() );
            arc.update( ice );
        }

        ICacheElement element = arc.get( 0 + ":key" );

        System.out.println( "testHitInT1ThenT2BelowMax " + arc.getStats() );

        assertNotNull( "Should have the element.", element );
        assertEquals( "Target t1 should be 1/2 until dupe gets or puts.", max / 2, arc.getTarget_T1() );
View Full Code Here

        else
        {
            // we could just use the default.
            log.warn( "ElementSerializer is null.  Could not serialize object." );
        }
        ICacheElement deSerialized = new CacheElement( serialized.getCacheName(), serialized.getKey(), deSerialzedValue );
        deSerialized.setElementAttributes( serialized.getElementAttributes() );

        return deSerialized;
    }
View Full Code Here

        int max = cache.getCacheAttributes().getMaxObjects();
        int items = max;

        for ( int i = 0; i < items; i++ )
        {
            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
            ice.setElementAttributes( cache.getElementAttributes() );
            arc.update( ice );
        }

        ICacheElement element = arc.get( 0 + ":key" );

        System.out.println( "testHitInT1AtMax " + arc.getStats() );

        assertNotNull( "Should have the element.", element );
        assertEquals( "Target t1 should be 1/2 until dupe gets or puts.", max / 2, arc.getTarget_T1() );
View Full Code Here

        ICacheElementSerialized element = new CacheElementSerialized( cacheName, key, elementSerializer
            .serialize( value ), attr );
        listener.handlePut( element );

        ICacheElement after = cacheMgr.getCache( cacheName ).get( key );

        assertNotNull( "Should have a deserialized object.", after );
        assertEquals( "Values should be the same.", value, after.getVal() );
        assertEquals( "Attributes should be the same.", attr.getMaxLifeSeconds(), after
            .getElementAttributes().getMaxLifeSeconds() );
        assertEquals( "Keys should be the same.", key, after.getKey() );
        assertEquals( "Cache name should be the same.", cacheName, after.getCacheName() );
    }
View Full Code Here

        int max = cache.getCacheAttributes().getMaxObjects();
        int items = max + 1;

        for ( int i = 0; i < items; i++ )
        {
            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
            ice.setElementAttributes( cache.getElementAttributes() );
            arc.update( ice );
        }

        ICacheElement element = arc.get( 0 + ":key" );

        System.out.println( "testHitInT1OverMax " + arc.getStats() );

        assertNull( "Should not have the element since it was the first.", element );
        assertEquals( "Target t1 should be 1/2 until dupe gets or puts.", max / 2, arc.getTarget_T1() );
View Full Code Here

        int max = cache.getCacheAttributes().getMaxObjects();
        int items = max;

        for ( int i = 0; i < items; i++ )
        {
            ICacheElement ice = new CacheElement( cache.getCacheName(), i + ":key", cache.getCacheName() + " data " + i );
            ice.setElementAttributes( cache.getElementAttributes() );
            arc.update( ice );
        }

        //ICacheElement element = arc.get( 0 + ":key" );
View Full Code Here

TOP

Related Classes of org.apache.jcs.engine.behavior.ICacheElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.