import org.infinispan.Cache; import org.infinispan.configuration.cache.CacheMode; import org.infinispan.configuration.cache.ConfigurationBuilder; import org.infinispan.manager.DefaultCacheManager; public class DistributedCacheExample { public static void main(String[] args) { DefaultCacheManager cacheManager = new DefaultCacheManager(); ConfigurationBuilder builder = new ConfigurationBuilder(); Cache<String, String> cache = cacheManager.getCache("myCache"); cache.put("key1", "value1"); cache.put("key2", "value2"); String value1 = cache.get("key1"); String value2 = cache.get("key2"); System.out.println("Value from cache: " + value1); System.out.println("Value from cache: " + value2); cacheManager.stop(); } }


上一篇:
下一篇:
切换中文