Package org.apache.jcs.engine.control

Examples of org.apache.jcs.engine.control.CompositeCache


                            log.debug( "puts = " + puts );
                        }
                    }

                    getCacheManager();
                    CompositeCache cache = cacheMgr.getCache( irca.getCacheName() );
                    cache.localUpdate( cb );

                }

            }
            else
View Full Code Here


            log.debug( "handleRemove> cacheName=" + cacheName + ", key=" + key );
        }

        getCacheManager();
        CompositeCache cache = ( CompositeCache ) cacheMgr.getCache( cacheName );

        cache.localRemove( key );
    }
View Full Code Here

     * @throws Exception
     */
    public LinkedList buildElementInfo( String cacheName )
        throws Exception
    {
        CompositeCache cache = cacheHub.getCache( cacheName );

        Object[] keys = cache.getMemoryCache().getKeyArray();

        // Attempt to sort keys according to their natural ordering. If that
        // fails, get the key array again and continue unsorted.

        try
        {
            Arrays.sort( keys );
        }
        catch ( Exception e )
        {
            keys = cache.getMemoryCache().getKeyArray();
        }

        LinkedList records = new LinkedList();

        ICacheElement element;
        IElementAttributes attributes;
        CacheElementInfo elementInfo;

        DateFormat format = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT );

        long now = System.currentTimeMillis();

        for ( int i = 0; i < keys.length; i++ )
        {
            element = cache.getMemoryCache().getQuiet( (Serializable) keys[i] );

            attributes = element.getElementAttributes();

            elementInfo = new CacheElementInfo();

View Full Code Here

        Arrays.sort( cacheNames );

        LinkedList cacheInfo = new LinkedList();

        CacheRegionInfo regionInfo;
        CompositeCache cache;

        for ( int i = 0; i < cacheNames.length; i++ )
        {
            cache = cacheHub.getCache( cacheNames[i] );
View Full Code Here

    public void runTestForRegion( String region )
        throws Exception
    {
        CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance();
        cacheMgr.configure( "/TestDiskCache.ccf" );
        CompositeCache cache = cacheMgr.getCache( region );

        LRUMemoryCache lru = new LRUMemoryCache();
        lru.initialize( cache );

        // Add items to cache

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

        // Test that initial items have been purged
View Full Code Here

                    log.debug( "puts = " + puts );
                }
            }

            ensureCacheManager();
            CompositeCache cache = cacheMgr.getCache( cb.getCacheName() );

            // Eventually the instance of will not be necessary.
            if ( cb != null && cb instanceof ICacheElementSerialized )
            {
                if ( log.isDebugEnabled() )
                {
                    log.debug( "Object needs to be deserialized." );
                }
                try
                {
                    cb = SerializationConversionUtil.getDeSerializedCacheElement( (ICacheElementSerialized) cb,
                                                                                  this.elementSerializer );
                    if ( log.isDebugEnabled() )
                    {
                        log.debug( "Deserialized result = " + cb );
                    }
                }
                catch ( IOException e )
                {
                    throw e;
                }
                catch ( ClassNotFoundException e )
                {
                    log.error( "Received a serialized version of a class that we don't know about.", e );
                }
            }

            cache.localUpdate( cb );
        }

        return;
    }
View Full Code Here

            log.debug( "handleRemove> cacheName=" + cacheName + ", key=" + key );
        }

        ensureCacheManager();
        CompositeCache cache = cacheMgr.getCache( cacheName );

        cache.localRemove( key );
    }
View Full Code Here

        if ( log.isDebugEnabled() )
        {
            log.debug( "handleRemoveAll> cacheName=" + cacheName );
        }
        ensureCacheManager();
        CompositeCache cache = cacheMgr.getCache( cacheName );
        cache.localRemoveAll();
    }
View Full Code Here

    public void testGetKeyArray()
        throws Exception
    {
        CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance();
        cacheMgr.configure( "/TestARCCache.ccf" );
        CompositeCache cache = cacheMgr.getCache( "testGetKeyArray" );

        ARCMemoryCache arc = new ARCMemoryCache();
        arc.initialize( cache );

        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

    public void testHitInT1BelowMax()
        throws Exception
    {
        CompositeCacheManager cacheMgr = CompositeCacheManager.getUnconfiguredInstance();
        cacheMgr.configure( "/TestARCCache.ccf" );
        CompositeCache cache = cacheMgr.getCache( "testGetKeyArray" );

        ARCMemoryCache arc = new ARCMemoryCache();
        arc.initialize( cache );

        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

TOP

Related Classes of org.apache.jcs.engine.control.CompositeCache

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.