Package org.infinispan.manager

Examples of org.infinispan.manager.DefaultCacheManager


  
   public DefaultCacheManager getCacheManager(String configFile) {
     if (manager == null) {
       log.info("DefaultCacheManager does not exist - constructing a new via " + configFile);
       try {
        manager = new DefaultCacheManager(ResourceLoader.getInstance().getResourceAsStream(configFile), true);
      } catch (IOException e) {
        throw new IllegalArgumentException(configFile + " can not find", e);
      }
     }
     return manager;
View Full Code Here


                .lockingMode(LockingMode.OPTIMISTIC).transactionManagerLookup(new GenericTransactionManagerLookup()) //uses GenericTransactionManagerLookup - This is a lookup class that locate transaction managers in the most  popular Java EE application servers. If no transaction manager can be found, it defaults on the dummy transaction manager.
                .locking().isolationLevel(IsolationLevel.REPEATABLE_READ) //Sets the isolation level of locking
                .eviction().maxEntries(100).strategy(EvictionStrategy.LIRS) //Sets  4 as maximum number of entries in a cache instance and uses the LIRS strategy - an efficient low inter-reference recency set replacement policy to improve buffer cache performance
                .loaders().passivation(false).addFileCacheStore().purgeOnStartup(true) //Disable passivation and adds a FileCacheStore that is purged on Startup
                .build(); //Builds the Configuration object
            manager = new DefaultCacheManager(glob, loc, true);
            log.info("=== Using DefaultCacheManager (library mode) ===");
        }
        return manager;
    }
View Full Code Here

import org.infinispan.manager.DefaultCacheManager;

public class LocalCacheTest {

  public static void main(String[] args) throws IOException {
    Cache<Object, Object> c = new DefaultCacheManager("infinispan-local-inter.xml").getCache();
    System.out.println(c.getVersion());
    c.stop();
  }
View Full Code Here

 
  Cache<Object, Object> cache;

  @Before
  public void setup() {
    cache = new DefaultCacheManager().getCache();
  }
View Full Code Here

 
  Cache<Object, Object> cache;

  @Before
  public void setup() {
    EmbeddedCacheManager manager = new DefaultCacheManager();
    manager.defineConfiguration("custom-cache", new ConfigurationBuilder()
        .eviction().strategy(EvictionStrategy.LIRS).maxEntries(10)
        .build());
    cache = manager.getCache("custom-cache");
  }
View Full Code Here

    return configuration ;
  }
 
  public static void test() {
   
    EmbeddedCacheManager cacheManager = new DefaultCacheManager(initGlobalConfiguration(), initConfiguration());
 
    Cache<String, String> cache = cacheManager.getCache("Hello");
   
    System.out.println(cache.getCacheManager().getAddress());
  }
View Full Code Here

 
  Cache<Object, Object> cache;

  @Before
  public void setup() throws IOException {
    cache = new DefaultCacheManager("namedCache.xml").getCache("custom-cache");
  }
View Full Code Here

public class HelloWorldNamedCache {

  public static void main(String[] args) {
   
    EmbeddedCacheManager manager = new DefaultCacheManager();
   
    manager.defineConfiguration("named-cache", new ConfigurationBuilder().eviction().strategy(EvictionStrategy.LIRS).maxEntries(10).build());
   
    Cache<Object, Object> cache = manager.getCache("named-cache");
   
    for (int i = 0; i < 10; i++) {
      cache.put("key-" + i, new User(i, "Kylin Soong", "IT"));
    }
   
View Full Code Here

public class HelloWroldXmlConfiguredCache {

  public static void main(String[] args) throws IOException {

    EmbeddedCacheManager manager = new DefaultCacheManager("infinispan.xml");

    Cache<Object, Object> cache = manager.getCache("xml-configured-cache");

    for (int i = 0; i < 10; i++) {
      cache.put("key-" + i, new User(i, "Kylin Soong", "IT"));
    }
View Full Code Here

  protected String getCacheName() {
    return CACHE_NAME;
  }

  protected EmbeddedCacheManager createCacheManager() throws IOException {
    return new DefaultCacheManager(GlobalConfigurationBuilder.defaultClusteredBuilder().transport().addProperty("configurationFile", "jgroups.xml").build(),
                     new ConfigurationBuilder().clustering().cacheMode(CacheMode.REPL_SYNC).build());
  }
View Full Code Here

TOP

Related Classes of org.infinispan.manager.DefaultCacheManager

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.