Package org.apache.jcs.engine

Examples of org.apache.jcs.engine.ElementAttributes


        String key = "key";
        String value = "value";

        ICacheElement element = new CacheElement( "testRegion", key, value );

        ElementAttributes elementAttr = new ElementAttributes();
        elementAttr.setIsEternal( false );
        element.setElementAttributes( elementAttr );
        element.getElementAttributes().setMaxLifeSeconds( 1 );
        memory.update( element );

        ICacheElement returnedElement1 = memory.get( key );
View Full Code Here


            String key = "key" + i;
            String value = "value";

            ICacheElement element = new CacheElement( "testRegion", key, value );

            ElementAttributes elementAttr = new ElementAttributes();
            elementAttr.setIsEternal( false );
            element.setElementAttributes( elementAttr );
            element.getElementAttributes().setMaxLifeSeconds( 1 );
            memory.update( element );

            ICacheElement returnedElement1 = memory.get( key );
View Full Code Here

        String key = "key" + i;
        String value = "value";

        ICacheElement element = new CacheElement( "testRegion", key, value );

        ElementAttributes elementAttr = new ElementAttributes();
        elementAttr.addElementEventHandler( handler );
        elementAttr.setIsEternal( false );
        element.setElementAttributes( elementAttr );
        element.getElementAttributes().setMaxLifeSeconds( 1 );
        memory.update( element );

        ICacheElement returnedElement1 = memory.get( key );
View Full Code Here

                        {
                            p( "usage: put numbertoput" );
                        }
                        else
                        {
                            IElementAttributes attrp = new ElementAttributes();
                            long n_start = System.currentTimeMillis();
                            for ( int n = 0; n < num; n++ )
                            {
                                attrp.copy();
                            }
                            long n_end = System.currentTimeMillis();
                            p( "---cloned attr " + num + " in " + String.valueOf( n_end - n_start ) + " millis ---" );
                        }
                    }
View Full Code Here

        access = CacheAccess.getAccess( "test" );

        assertNotNull( "We should have an access class", access );

        long maxLife = 9876;
        IElementAttributes attr = new ElementAttributes();
        attr.setMaxLifeSeconds( maxLife );

        access.setDefaultElementAttributes( attr );

        assertEquals( "Wrong element attributes.", attr.getMaxLifeSeconds(), access.getDefaultElementAttributes()
            .getMaxLifeSeconds() );

        String key = "mykey";
        String value = "myvalue";
View Full Code Here

        long maxIdleTime = 8765;
        ca.setMaxMemoryIdleTimeSeconds( maxIdleTime );

        long maxLife = 9876;
        IElementAttributes attr = new ElementAttributes();
        attr.setMaxLifeSeconds( maxLife );

        CacheAccess access = CacheAccess.defineRegion( "testRegionDefinitonWithAttributes", ca, attr );
        assertNotNull( "We should have an access class", access );

        ICompositeCacheAttributes ca2 = access.getCacheAttributes();
View Full Code Here

        String key = "key";
        String value = "value fdsadf dsafdsa fdsaf dsafdsaf dsafdsaf dsaf dsaf dsaf dsafa dsaf dsaf dsafdsaf";

        IElementSerializer elementSerializer = new StandardSerializer();

        IElementAttributes attr = new ElementAttributes();
        attr.setMaxLifeSeconds( 34 );

        ICacheElement before = new CacheElement( cacheName, key, value );
        before.setElementAttributes( attr );

        ICacheElementSerialized serialized = SerializationConversionUtil.getSerializedCacheElement( before,
View Full Code Here

        String key = "key";
        String value = "value fdsadf dsafdsa fdsaf dsafdsaf dsafdsaf dsaf dsaf dsaf dsafa dsaf dsaf dsafdsaf";

        IElementSerializer elementSerializer = null;// new StandardSerializer();

        IElementAttributes attr = new ElementAttributes();
        attr.setMaxLifeSeconds( 34 );

        ICacheElement before = new CacheElement( cacheName, key, value );
        before.setElementAttributes( attr );

        try
View Full Code Here

                                "Object with id ["
                                        + id
                                        + "] is not serializable. Expect problems with auxiliary caches.");
            }

            ElementAttributes attrib = (ElementAttributes) this.cacheManager
                    .getDefaultElementAttributes();

            if (o instanceof RefreshableCachedObject)
            {
                attrib.setIsEternal(true);
            }
            else
            {
                attrib.setIsEternal(false);
                attrib.setMaxLifeSeconds((o.getExpires() + 500) / 1000);
            }

            attrib.setLastAccessTimeNow();
            attrib.setCreateTime();

            this.cacheManager.putInGroup(id, group, o, attrib);
        }
        catch (CacheException e)
        {
View Full Code Here

TOP

Related Classes of org.apache.jcs.engine.ElementAttributes

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.