Package org.apache.jcs.engine

Examples of org.apache.jcs.engine.CacheElement


        watch = (ICacheObserver) obj;

        p( "subscribing to the server" );

        watch.addCacheListener( "testCache", this );
        ICacheElement cb = new CacheElement( "testCache", "testKey", "testVal" );

        for ( int i = 0; i < count; i++ )
        {
            cb = new CacheElement( "testCache", "" + i, "" + i );

            if ( delete )
            {
                p( "deleting a cache item from the server " + i );

                cache.remove( cb.getCacheName(), cb.getKey() );
            }
            if ( write )
            {
                p( "putting a cache bean to the server " + i );

                try
                {
                    cache.update( cb );
                }
                catch ( ObjectExistsException oee )
                {
                    p( oee.toString() );
                }
            }
            if ( read )
            {
                try
                {
                    Object val = cache.get( cb.getCacheName(), cb.getKey() );
                    p( "get " + cb.getKey() + " returns " + val );
                }
                catch ( CacheException onfe )
                {
                    // nothing
                }
View Full Code Here


        // get removed.";
        //p( "dataToPassHashCodeCompare hashcode = " + +
        // dataToPassHashCodeCompare.hashCode() );

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

        cache.put( keyToNotBeRemovedOnPut, dataToPassHashCodeCompare );
        ICacheElement element2 = new CacheElement( region, keyToNotBeRemovedOnPut, dataToPassHashCodeCompare );
        service.update( element2 );

        /*
         * 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 =
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" );
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" );
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

        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

        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" );
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;

        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.CacheElement

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.