|
Hazelcast是一個高度可擴(kuò)展的數(shù)據(jù)分發(fā)和集群平臺,可用于實(shí)現(xiàn)分布式數(shù)據(jù)存儲、數(shù)據(jù)緩存。特性包括:
示例代碼: import com.hazelcast.config.Config;import com.hazelcast.core.Hazelcast;import com.hazelcast.core.HazelcastInstance;
import java.util.concurrent.ConcurrentMap;
public class DistributedMap { public static void main(String[] args) {
Config config = new Config();
HazelcastInstance h = Hazelcast.newHazelcastInstance(config);
ConcurrentMap<String, String> map = h.getMap("my-distributed-map");
map.put("key", "value");
map.get("key");
//Concurrent Map methods map.putIfAbsent("somekey", "somevalue");
map.replace("key", "value", "newvalue");
}
}
|
|
|