Java Code Examples for com.hazelcast.config.MapConfig#addMapIndexConfig()

The following examples show how to use com.hazelcast.config.MapConfig#addMapIndexConfig() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StaticMapConfig.java    From hazelcast-demo with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	MapConfig mapConfig = new MapConfig();
	mapConfig.setName("cacheMap")// 设置Map名称
			.setInMemoryFormat(InMemoryFormat.BINARY)// 设置内存格式
			.setBackupCount(1);// 设置副本个数

	mapConfig.getMapStoreConfig()//
			.setWriteDelaySeconds(60)//
			.setWriteBatchSize(1000);// 设置缓存格式

	mapConfig.addMapIndexConfig(new MapIndexConfig().setAttribute("id").setOrdered(true));// 增加索引
	mapConfig.addMapIndexConfig(new MapIndexConfig().setAttribute("name").setOrdered(true));
}