Package net.sf.ehcache

Examples of net.sf.ehcache.Cache$CacheStatus


        cacheConfiguration.setOverflowToDisk( false );
        cacheConfiguration.setCacheLoaderTimeoutMillis( 0 );
        cacheConfiguration.setMaxElementsInMemory( cacheSize );
        cacheConfiguration.setMemoryStoreEvictionPolicy( "LRU" );

        cache = new Cache( cacheConfiguration );
        cache.initialise();

        // Initialize the txnManager thread
        //FIXME we should NOT create a new transaction manager thread for each BTree
        //createTransactionManager();
View Full Code Here


            throw new IllegalStateException( "CacheService was not initialized" );
        }

        LOG.info( "fetching the cache named {}", name );

        Cache cache = cacheManager.getCache( name );

        if ( cache == null )
        {
            cacheManager.addCache( name );
            cache = cacheManager.getCache( name );
View Full Code Here

    {
        PrincipalStore store = new DirectoryPrincipalStore( getDirectoryService(), new Dn( this.getSearchBaseDn() ) );

        LOG.debug( "initializing the changepassword replay cache" );

        Cache cache = getDirectoryService().getCacheService().getCache( "changePwdReplayCache" );
        replayCache = new ReplayCacheImpl( cache );

        for ( Transport transport : transports )
        {
            IoAcceptor acceptor = transport.getAcceptor();
View Full Code Here

        store = new DirectoryPrincipalStore( getDirectoryService(), new Dn( this.getSearchBaseDn() ) );

        LOG.debug( "initializing the kerberos replay cache" );

        Cache cache = getDirectoryService().getCacheService().getCache( "kdcReplayCache" );
        replayCache = new ReplayCacheImpl( cache, config.getAllowableClockSkew() );

        // Kerberos can use UDP or TCP
        for ( Transport transport : transports )
        {
View Full Code Here

            long clockSkew = 1000; // 1 sec

            cacheManager = new CacheManager();

            cacheManager.addCache( "kdcReplayCache" );
            Cache ehCache = cacheManager.getCache( "kdcReplayCache" );
            ehCache.getCacheConfiguration().setMaxElementsInMemory( 2 );
            ehCache.getCacheConfiguration().setTimeToLiveSeconds( 1 );
            ehCache.getCacheConfiguration().setTimeToIdleSeconds( 1 );
            ehCache.getCacheConfiguration().setDiskExpiryThreadIntervalSeconds( 1 );

            ReplayCacheImpl cache = new ReplayCacheImpl( ehCache, clockSkew );

            int i = 0;

            // Inject 4 entries
            while ( i < 4 )
            {
                KerberosPrincipal serverPrincipal = new KerberosPrincipal( "server" + i + "@APACHE.ORG",
                    PrincipalNameType.KRB_NT_PRINCIPAL.getValue() );
                KerberosPrincipal clientPrincipal = new KerberosPrincipal( "client" + i + "@APACHE.ORG",
                    PrincipalNameType.KRB_NT_PRINCIPAL.getValue() );

                cache.save( serverPrincipal, clientPrincipal, new KerberosTime( System.currentTimeMillis() ), 0 );

                i++;
            }

            List<?> keys = ehCache.getKeys();

            // We should have 4 entries
            assertTrue( keys.size() != 0 );

            // Wait till the timetolive time exceeds
            Thread.sleep( 1200 );

            // then access the cache so that the objects present in the cache will be expired
            for ( Object k : keys )
            {
                assertNull( ehCache.get( k ) );
            }

            assertEquals( 0, ehCache.getKeys().size() );
        }
        finally
        {
            if ( cacheManager != null )
            {
View Full Code Here

            {
                cacheConfiguration =
                    cacheConfiguration.maxBytesLocalOffHeap( getMaxBytesLocalOffHeap(), MemoryUnit.BYTES );
            }

            ehcache = new Cache( cacheConfiguration );

            cacheManager.addCache( ehcache );
            // TODO not supported anymore?
            //ehcache.setStatisticsEnabled( statisticsEnabled );
        }
View Full Code Here

                if (cacheManager != null)
                {
                    cache = cacheManager.getCache("applicationServiceCache");
                    if (cache == null)
                    {
                        cache = new Cache("applicationServiceCache", 100, true,
                                true, 0, 0, false, 600);
                        cacheManager.addCache(cache);
                    }
                }
            }
View Full Code Here

        cacheManager = EHCacheManagerHolder.getCacheManager(bus, configFileURL);
        // Cannot overflow to disk as SecurityToken Elements can't be serialized
        CacheConfiguration cc = EHCacheManagerHolder.getCacheConfiguration(key, cacheManager)
            .overflowToDisk(false); //tokens not writable
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
       
        // Set the TimeToLive value from the CacheConfiguration
        ttl = cc.getTimeToLiveSeconds();
    }
View Full Code Here

            cacheManager = EHCacheUtil.createCacheManager(conf);
        }
       
        CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(CACHE_KEY, cacheManager);
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here

        cacheConfiguration.setOverflowToDisk( false );
        cacheConfiguration.setCacheLoaderTimeoutMillis( 0 );
        cacheConfiguration.setMaxElementsInMemory( cacheSize );
        cacheConfiguration.setMemoryStoreEvictionPolicy( "LRU" );

        cache = new Cache( cacheConfiguration );
        cache.initialise();

        // Initialize the txnManager thread
        //FIXME we should NOT create a new transaction manager thread for each BTree
        //createTransactionManager();
View Full Code Here

TOP

Related Classes of net.sf.ehcache.Cache$CacheStatus

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.