Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.ConfigurationBuilder.eviction()


   }

   private ConfigurationBuilder asyncStoreWithEvictionBuilder() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      // Emulate eviction with direct data container eviction
      builder.eviction().strategy(EvictionStrategy.LRU).maxEntries(1)
            .persistence()
            .addStore(DummyInMemoryStoreConfigurationBuilder.class)
            .async().enabled(true);
      return builder;
   }
View Full Code Here


      c.storeAsBinary().enable();
      Configuration lazy = cm.defineConfiguration("storeAsBinary", c.build());
      assert lazy.storeAsBinary().enabled();

      c = new ConfigurationBuilder().read(lazy);
      c.eviction().strategy(EvictionStrategy.LRU).maxEntries(1);
      Configuration lazyLru = cm.defineConfiguration("lazyDeserializationWithLRU", c.build());
      assert lazy.storeAsBinary().enabled();
      assert lazyLru.eviction().strategy() == EvictionStrategy.LRU;
   }
View Full Code Here

      SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(schemaFile).newValidator().validate(xmlFile);
   }

   public void testEvictionWithoutStrategy() {
      ConfigurationBuilder cb = new ConfigurationBuilder();
      cb.eviction().maxEntries(76767);
      withCacheManager(new CacheManagerCallable(createCacheManager(cb)) {
         @Override
         public void call() {
            Configuration cfg = cm.getCache().getCacheConfiguration();
            assert cfg.eviction().maxEntries() == 76767;
View Full Code Here

   private final Integer MAX_CACHE_ELEMENTS = 10 * 1000 * 1000;

   @Override
   protected EmbeddedCacheManager createCacheManager() throws Exception {
      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg
         .eviction().strategy(EvictionStrategy.LRU).maxEntries(MAX_CACHE_ELEMENTS)
         .expiration().wakeUpInterval(3000L)
         .build();
      EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(cfg);
      cache = cm.getCache();
View Full Code Here

@Test(groups = "unit", testName = "eviction.EvictionManagerTest")
public class EvictionManagerTest extends AbstractInfinispanTest {

   private ConfigurationBuilder getCfg() {
      ConfigurationBuilder builder = new ConfigurationBuilder();
      builder.eviction().strategy(EvictionStrategy.LRU).maxEntries(123);
      return builder;
   }

   public void testNoEvictionThread() {
      EvictionManagerImpl em = new EvictionManagerImpl();
View Full Code Here

   @Test(expectedExceptions = CacheConfigurationException.class)
   public void testEvictionOnButWithoutMaxEntries() {
      EmbeddedCacheManager ecm = null;
      try {
         ConfigurationBuilder c = new ConfigurationBuilder();
         c.eviction().strategy(EvictionStrategy.LRU);
         ecm = TestCacheManagerFactory.createClusteredCacheManager(c);
         ecm.getCache();
      } finally {
         TestingUtil.killCacheManagers(ecm);
      }
View Full Code Here

   protected boolean txEnabled = false;

   @Override
   protected void createCacheManagers() throws Throwable {
      ConfigurationBuilder configBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
      configBuilder.eviction().maxEntries(1).strategy(EvictionStrategy.LRU)
            .persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class);

      addClusterEnabledCacheManager(configBuilder);
   }
View Full Code Here

   private ConfigurationBuilder buildCfg(EvictionThreadPolicy threadPolicy, EvictionStrategy strategy) {
      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg
         .persistence().passivation(true).addStore(DummyInMemoryStoreConfigurationBuilder.class).purgeOnStartup(true)
         .invocationBatching().enable();
      cfg.eviction().strategy(strategy);
      // If the strategy is NONE then don't use thread policy or strategy or max entries (forces default strategy)
      if (strategy != EvictionStrategy.NONE) {
         cfg.eviction().threadPolicy(threadPolicy).maxEntries(EVICTION_MAX_ENTRIES);
      }
      return cfg;
View Full Code Here

         .persistence().passivation(true).addStore(DummyInMemoryStoreConfigurationBuilder.class).purgeOnStartup(true)
         .invocationBatching().enable();
      cfg.eviction().strategy(strategy);
      // If the strategy is NONE then don't use thread policy or strategy or max entries (forces default strategy)
      if (strategy != EvictionStrategy.NONE) {
         cfg.eviction().threadPolicy(threadPolicy).maxEntries(EVICTION_MAX_ENTRIES);
      }
      return cfg;
   }

   @Override
View Full Code Here

   @Override
   protected void createCacheManagers() throws Throwable {
      ConfigurationBuilder builder = getDefaultClusteredCacheConfig(
            CacheMode.REPL_SYNC, true);
      builder.eviction().maxEntries(1024)
            .persistence().passivation(true)
            .addStore(DummyInMemoryStoreConfigurationBuilder.class);
      createClusteredCaches(2, "atomic", builder);
   }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.