Package net.sf.ehcache.config

Examples of net.sf.ehcache.config.CacheConfiguration$CacheDecoratorFactoryConfiguration


        if (configFileURL != null) {
            cacheManager = EHCacheManagerHolder.getCacheManager(bus, configFileURL);
        } else {
            cacheManager = EHCacheManagerHolder.getCacheManager(bus, getDefaultConfigFileURL());
        }
        CacheConfiguration cc = EHCacheManagerHolder.getCacheConfiguration(key, cacheManager);
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here


    private final MetricRegistry registry = new MetricRegistry();
    private Ehcache cache;

    @Before
    public void setUp() throws Exception {
        final Cache c = new Cache(new CacheConfiguration("test", 100));
        MANAGER.addCache(c);
        this.cache = InstrumentedEhcache.instrument(registry, c);
    }
View Full Code Here

        readTransactions = new ConcurrentLinkedQueue<Transaction<K, V>>();

        writeLock = new ReentrantLock();

        // Initialize the caches
        CacheConfiguration cacheConfiguration = new CacheConfiguration();
        cacheConfiguration.setName( "pages" );
        cacheConfiguration.setEternal( true );
        cacheConfiguration.setOverflowToDisk( false );
        cacheConfiguration.setCacheLoaderTimeoutMillis( 0 );
        cacheConfiguration.setMaxElementsInMemory( cacheSize );
        cacheConfiguration.setMemoryStoreEvictionPolicy( "LRU" );

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

        // Initialize the txnManager thread
View Full Code Here

            }
        }

        if ( !cacheExists )
        {
            CacheConfiguration cacheConfiguration =
                new CacheConfiguration().name( getName() ).memoryStoreEvictionPolicy(
                    getMemoryStoreEvictionPolicy() ).eternal( isEternal() ).timeToLiveSeconds(
                    getTimeToLiveSeconds() ).timeToIdleSeconds(
                    getTimeToIdleSeconds() ).diskExpiryThreadIntervalSeconds(
                    getDiskExpiryThreadIntervalSeconds() ).overflowToOffHeap(
                    isOverflowToOffHeap() ).maxEntriesLocalDisk( getMaxElementsOnDisk() ).diskPersistent(
                    isDiskPersistent() ).overflowToDisk( overflowToDisk );

            if ( getMaxElementsInMemory() > 0 )
            {
                cacheConfiguration = cacheConfiguration.maxEntriesLocalHeap( getMaxElementsInMemory() );
            }

            if ( getMaxBytesLocalHeap() > 0 )
            {
                cacheConfiguration = cacheConfiguration.maxBytesLocalHeap( getMaxBytesLocalHeap(), MemoryUnit.BYTES );
            }
            if ( getMaxBytesLocalOffHeap() > 0 )
            {
                cacheConfiguration =
                    cacheConfiguration.maxBytesLocalOffHeap( getMaxBytesLocalOffHeap(), MemoryUnit.BYTES );
            }

            ehcache = new Cache( cacheConfiguration );

            cacheManager.addCache( ehcache );
View Full Code Here

            b.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(this);
        }

        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

    }
   
   
    public static CacheConfiguration getCacheConfiguration(String key,
                                                           CacheManager cacheManager) {
        CacheConfiguration cc = cacheManager.getConfiguration().getCacheConfigurations().get(key);
        if (cc == null && key.contains("-")) {
            cc = cacheManager.getConfiguration().getCacheConfigurations().get(
                    key.substring(0, key.lastIndexOf('-')));
        }
        if (cc == null) {
            cc = cacheManager.getConfiguration().getDefaultCacheConfiguration();
        }
        if (cc == null) {
            cc = new CacheConfiguration();
        } else {
            cc = (CacheConfiguration)cc.clone();
        }
        cc.setName(key);
        return cc;
    }
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

        {
            type = BTreeTypeEnum.IN_MEMORY;
        }

        // Initialize the caches
        CacheConfiguration cacheConfiguration = new CacheConfiguration();
        cacheConfiguration.setName( "pages" );
        cacheConfiguration.setEternal( true );
        cacheConfiguration.setOverflowToDisk( false );
        cacheConfiguration.setCacheLoaderTimeoutMillis( 0 );
        cacheConfiguration.setMaxElementsInMemory( cacheSize );
        cacheConfiguration.setMemoryStoreEvictionPolicy( "LRU" );

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

        // Initialize the txnManager thread
View Full Code Here

        } else {
            Configuration conf = ConfigurationFactory.parseConfiguration(configFileURL);
            cacheManager = CacheManager.create(conf);
        }
       
        CacheConfiguration cc = EHCacheUtil.getCacheConfiguration(key, cacheManager);
       
        Ehcache newCache = new Cache(cc);
        cache = cacheManager.addCacheIfAbsent(newCache);
    }
View Full Code Here

    public static Store create( Ehcache cache, String diskStorePath, Pool<PoolableStore> onHeapPool,
                                Pool<PoolableStore> onDiskPool )
    {

        CacheConfiguration config = cache.getCacheConfiguration();
        MemoryStore memoryStore = createMemoryStore( cache, onHeapPool );
        DirectMemoryStore offHeapStore = createOffHeapStore( cache, true );
        DiskStore diskStore = null; //need to implement disk backing to store.
        Store store = null;
        if ( diskStore == null )
        {
            store = new FrontEndCacheTier<MemoryStore, DirectMemoryStore>( memoryStore, offHeapStore,
                                                                           config.getCopyStrategy(),
                                                                           config.isCopyOnWrite(),
                                                                           config.isCopyOnRead() )
            {

                @Override
                public Object getMBean()
                {
View Full Code Here

TOP

Related Classes of net.sf.ehcache.config.CacheConfiguration$CacheDecoratorFactoryConfiguration

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.