Package org.infinispan.loaders

Source Code of org.infinispan.loaders.FileCacheLoaderTest

package org.infinispan.loaders;

import java.io.IOException;
import java.util.Map.Entry;
import java.util.UUID;

import org.infinispan.Cache;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;

public class FileCacheLoaderTest {

  public static void main(String[] args) throws IOException {
   
    EmbeddedCacheManager cacheManager = new DefaultCacheManager("infinispan-loaders-file.xml");
   
    Cache<Object, Object> cache = cacheManager.getCache("custom-cache-loader");
   
    for(int i = 1 ; i <= 15 ; i ++){
      cache.put(i, UUID.randomUUID().toString());
    }
   
    log("Total entities in cache: " + cache.size());
   
    printCacheEntities(cache);
   
    cache.stop();
   
    cacheManager.stop();
  }
 
  private static void printCacheEntities(Cache<Object, Object> cache) {
    for(Entry<Object, Object> entry : cache.entrySet()){
      log(entry.getKey() + " -> " + entry.getValue());
    }
  }

  public static void log(String s) {
    System.out.println(s);
  }

}
TOP

Related Classes of org.infinispan.loaders.FileCacheLoaderTest

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.