com.hazelcast.config.MapConfig Java Examples
The following examples show how to use
com.hazelcast.config.MapConfig.
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: AdminApplicationHazelcastTest.java From Moss with Apache License 2.0 | 6 votes |
@Bean public Config hazelcastConfig() { MapConfig mapConfig = new MapConfig("spring-boot-admin-event-store").setInMemoryFormat(InMemoryFormat.OBJECT) .setBackupCount(1) .setEvictionPolicy(EvictionPolicy.NONE) .setMergePolicyConfig(new MergePolicyConfig( PutIfAbsentMapMergePolicy.class.getName(), 100 )); Config config = new Config(); config.addMapConfig(mapConfig); config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig(); tcpIpConfig.setEnabled(true); tcpIpConfig.setMembers(singletonList("127.0.0.1")); return config; }
Example #2
Source File: AdminApplicationHazelcastTest.java From spring-boot-admin with Apache License 2.0 | 6 votes |
@Bean public Config hazelcastConfig() { MapConfig eventStoreMap = new MapConfig(DEFAULT_NAME_EVENT_STORE_MAP) .setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setEvictionPolicy(EvictionPolicy.NONE) .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100)); MapConfig sentNotificationsMap = new MapConfig(DEFAULT_NAME_SENT_NOTIFICATIONS_MAP) .setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setEvictionPolicy(EvictionPolicy.LRU) .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100)); Config config = new Config(); config.addMapConfig(eventStoreMap); config.addMapConfig(sentNotificationsMap); config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig(); tcpIpConfig.setEnabled(true); tcpIpConfig.setMembers(singletonList("127.0.0.1")); return config; }
Example #3
Source File: DistributedTableMetadataManager.java From foxtrot with Apache License 2.0 | 6 votes |
private MapConfig tableMapConfig() { MapConfig mapConfig = new MapConfig(); mapConfig.setReadBackupData(true); mapConfig.setInMemoryFormat(InMemoryFormat.BINARY); mapConfig.setTimeToLiveSeconds(TIME_TO_LIVE_TABLE_CACHE); mapConfig.setBackupCount(0); MapStoreConfig mapStoreConfig = new MapStoreConfig(); mapStoreConfig.setFactoryImplementation(TableMapStore.factory(elasticsearchConnection)); mapStoreConfig.setEnabled(true); mapStoreConfig.setInitialLoadMode(MapStoreConfig.InitialLoadMode.EAGER); mapConfig.setMapStoreConfig(mapStoreConfig); NearCacheConfig nearCacheConfig = new NearCacheConfig(); nearCacheConfig.setTimeToLiveSeconds(TIME_TO_LIVE_TABLE_CACHE); nearCacheConfig.setInvalidateOnChange(true); mapConfig.setNearCacheConfig(nearCacheConfig); return mapConfig; }
Example #4
Source File: HazelCastConfigration.java From sctalk with Apache License 2.0 | 6 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); /* * Number of backups. If 1 is set as the backup-count for example, then all entries of the * map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, * 3. */ mapConfig.setBackupCount(1); /* * Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently * Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* * Maximum size of the map. When max size is reached, map is evicted based on the policy * defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default * is 0. */ mapConfig .setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; }
Example #5
Source File: ClusterManager.java From foxtrot with Apache License 2.0 | 6 votes |
@Inject public ClusterManager(HazelcastConnection connection, List<HealthCheck> healthChecks, ServerFactory serverFactory) throws IOException { this.hazelcastConnection = connection; this.healthChecks = healthChecks; MapConfig mapConfig = new MapConfig(MAP_NAME); mapConfig.setTimeToLiveSeconds(MAP_REFRESH_TIME + 2); //Reduce jitter mapConfig.setBackupCount(1); mapConfig.setAsyncBackupCount(2); mapConfig.setEvictionPolicy(EvictionPolicy.NONE); hazelcastConnection.getHazelcastConfig() .getMapConfigs() .put(MAP_NAME, mapConfig); String hostname = Inet4Address.getLocalHost() .getCanonicalHostName(); //Auto detect marathon environment and query for host environment variable if(!Strings.isNullOrEmpty(System.getenv("HOST"))) hostname = System.getenv("HOST"); Preconditions.checkNotNull(hostname, "Could not retrieve hostname, cannot proceed"); int port = ServerUtils.port(serverFactory); //Auto detect marathon environment and query for host environment variable if(!Strings.isNullOrEmpty(System.getenv("PORT_" + port))) port = Integer.parseInt(System.getenv("PORT_" + port)); executor = Executors.newScheduledThreadPool(1); clusterMember = new ClusterMember(hostname, port); }
Example #6
Source File: HazelcastOperationMapsConfig.java From eventapis with Apache License 2.0 | 6 votes |
@Override public Config configure(Config config) { List<MapIndexConfig> indexes = Arrays.asList( new MapIndexConfig("spanningServices[any].serviceName", true) ); MapConfig mapConfig = new MapConfig(EVENTS_OPS_MAP_NAME) .setMapIndexConfigs(indexes) .setMaxSizeConfig(new MaxSizeConfig(evictFreePercentage, MaxSizeConfig.MaxSizePolicy.FREE_HEAP_PERCENTAGE)) .setEvictionPolicy(EvictionPolicy.LRU) .setQuorumName("default") .setName(EVENTS_OPS_MAP_NAME); config.addMapConfig(mapConfig); return config; }
Example #7
Source File: MapMaxSizeTest.java From hazelcast-simulator with Apache License 2.0 | 6 votes |
@Setup public void setUp() { map = targetInstance.getMap(name); operationCounterList = targetInstance.getList(name + "OperationCounter"); if (isMemberNode(targetInstance)) { MapConfig mapConfig = targetInstance.getConfig().getMapConfig(name); EvictionConfig evictionConfig = mapConfig.getEvictionConfig(); maxSizePerNode = evictionConfig.getSize(); assertEqualsStringFormat("Expected MaxSizePolicy %s, but was %s", PER_NODE, evictionConfig.getMaxSizePolicy()); assertTrue("Expected MaxSizePolicy.getSize() < Integer.MAX_VALUE", maxSizePerNode < Integer.MAX_VALUE); logger.info("Eviction config of " + name + ": " + evictionConfig); } }
Example #8
Source File: MapEvictAndStoreTest.java From hazelcast-simulator with Apache License 2.0 | 6 votes |
@Verify(global = false) public void verify() { if (isClient(targetInstance)) { return; } MapConfig mapConfig = targetInstance.getConfig().getMapConfig(name); logger.info(name + ": MapConfig: " + mapConfig); MapStoreConfig mapStoreConfig = mapConfig.getMapStoreConfig(); logger.info(name + ": MapStoreConfig: " + mapStoreConfig); int sleepSeconds = mapConfig.getTimeToLiveSeconds() * 2 + mapStoreConfig.getWriteDelaySeconds() * 2; logger.info("Sleeping for " + sleepSeconds + " seconds to wait for delay and TTL values."); sleepSeconds(sleepSeconds); MapStoreWithCounterPerKey mapStore = (MapStoreWithCounterPerKey) mapStoreConfig.getImplementation(); logger.info(name + ": map size = " + map.size()); logger.info(name + ": map store = " + mapStore); logger.info(name + ": Checking if some keys where stored more than once"); for (Object key : mapStore.keySet()) { assertEquals("There were multiple calls to MapStore.store", 1, mapStore.valueOf(key)); } }
Example #9
Source File: HazelcastConfig.java From tutorials with MIT License | 5 votes |
@Bean public Config hazelcast() { MapConfig eventStoreMap = new MapConfig("spring-boot-admin-event-store").setInMemoryFormat(InMemoryFormat.OBJECT) .setBackupCount(1) .setEvictionPolicy(EvictionPolicy.NONE) .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100)); MapConfig sentNotificationsMap = new MapConfig("spring-boot-admin-application-store").setInMemoryFormat(InMemoryFormat.OBJECT) .setBackupCount(1) .setEvictionPolicy(EvictionPolicy.LRU) .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100)); Config config = new Config(); config.addMapConfig(eventStoreMap); config.addMapConfig(sentNotificationsMap); config.setProperty("hazelcast.jmx", "true"); config.getNetworkConfig() .getJoin() .getMulticastConfig() .setEnabled(false); TcpIpConfig tcpIpConfig = config.getNetworkConfig() .getJoin() .getTcpIpConfig(); tcpIpConfig.setEnabled(true); tcpIpConfig.setMembers(Collections.singletonList("127.0.0.1")); return config; }
Example #10
Source File: CacheConfiguration.java From tutorials with MIT License | 5 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); /* Number of backups. If 1 is set as the backup-count for example, then all entries of the map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. */ mapConfig.setBackupCount(0); /* Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* Maximum size of the map. When max size is reached, map is evicted based on the policy defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default is 0. */ mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; }
Example #11
Source File: CacheConfiguration.java From tutorials with MIT License | 5 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); /* Number of backups. If 1 is set as the backup-count for example, then all entries of the map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. */ mapConfig.setBackupCount(0); /* Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* Maximum size of the map. When max size is reached, map is evicted based on the policy defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default is 0. */ mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; }
Example #12
Source File: DistributedTableMetadataManager.java From foxtrot with Apache License 2.0 | 5 votes |
private MapConfig cardinalityFieldMetaMapConfig() { MapConfig mapConfig = new MapConfig(); mapConfig.setReadBackupData(true); mapConfig.setInMemoryFormat(InMemoryFormat.BINARY); mapConfig.setTimeToLiveSeconds(TIME_TO_LIVE_CARDINALITY_CACHE); mapConfig.setBackupCount(0); NearCacheConfig nearCacheConfig = new NearCacheConfig(); nearCacheConfig.setTimeToLiveSeconds(TIME_TO_LIVE_CARDINALITY_CACHE); nearCacheConfig.setInvalidateOnChange(true); mapConfig.setNearCacheConfig(nearCacheConfig); return mapConfig; }
Example #13
Source File: DistributedTableMetadataManager.java From foxtrot with Apache License 2.0 | 5 votes |
private MapConfig fieldMetaMapConfig() { MapConfig mapConfig = new MapConfig(); mapConfig.setReadBackupData(true); mapConfig.setInMemoryFormat(InMemoryFormat.BINARY); mapConfig.setTimeToLiveSeconds(TIME_TO_LIVE_CACHE); mapConfig.setBackupCount(0); NearCacheConfig nearCacheConfig = new NearCacheConfig(); nearCacheConfig.setTimeToLiveSeconds(TIME_TO_NEAR_CACHE); nearCacheConfig.setInvalidateOnChange(true); mapConfig.setNearCacheConfig(nearCacheConfig); return mapConfig; }
Example #14
Source File: CacheConfiguration.java From tutorials with MIT License | 5 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); /* Number of backups. If 1 is set as the backup-count for example, then all entries of the map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. */ mapConfig.setBackupCount(0); /* Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* Maximum size of the map. When max size is reached, map is evicted based on the policy defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default is 0. */ mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; }
Example #15
Source File: DistributedCacheFactory.java From foxtrot with Apache License 2.0 | 5 votes |
private MapConfig getDefaultMapConfig(CacheConfig cacheConfig) { MapConfig mapConfig = new MapConfig(CACHE_NAME_PREFIX + "*"); mapConfig.setInMemoryFormat(InMemoryFormat.BINARY); mapConfig.setBackupCount(0); mapConfig.setEvictionPolicy(EvictionPolicy.LRU); if(cacheConfig.getMaxIdleSeconds() == 0) { mapConfig.setMaxIdleSeconds(DEFAULT_MAX_IDLE_SECONDS); } else { mapConfig.setMaxIdleSeconds(cacheConfig.getMaxIdleSeconds()); } if(cacheConfig.getTimeToLiveSeconds() == 0) { mapConfig.setTimeToLiveSeconds(DEFAULT_TIME_TO_LIVE_SECONDS); } else { mapConfig.setTimeToLiveSeconds(cacheConfig.getTimeToLiveSeconds()); } MaxSizeConfig maxSizeConfig = new MaxSizeConfig(); maxSizeConfig.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.USED_HEAP_PERCENTAGE); if(cacheConfig.getSize() == 0) { maxSizeConfig.setSize(DEFAULT_SIZE); } else { maxSizeConfig.setSize(cacheConfig.getSize()); } mapConfig.setMaxSizeConfig(maxSizeConfig); return mapConfig; }
Example #16
Source File: SpringBootAdminHazelcastApplication.java From spring-boot-admin with Apache License 2.0 | 5 votes |
@Bean public Config hazelcastConfig() { // This map is used to store the events. // It should be configured to reliably hold all the data, // Spring Boot Admin will compact the events, if there are too many MapConfig eventStoreMap = new MapConfig(DEFAULT_NAME_EVENT_STORE_MAP).setInMemoryFormat(InMemoryFormat.OBJECT) .setBackupCount(1).setEvictionPolicy(EvictionPolicy.NONE) .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100)); // This map is used to deduplicate the notifications. // If data in this map gets lost it should not be a big issue as it will atmost // lead to // the same notification to be sent by multiple instances MapConfig sentNotificationsMap = new MapConfig(DEFAULT_NAME_SENT_NOTIFICATIONS_MAP) .setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(1).setEvictionPolicy(EvictionPolicy.LRU) .setMergePolicyConfig(new MergePolicyConfig(PutIfAbsentMapMergePolicy.class.getName(), 100)); Config config = new Config(); config.addMapConfig(eventStoreMap); config.addMapConfig(sentNotificationsMap); config.setProperty("hazelcast.jmx", "true"); // WARNING: This setups a local cluster, you change it to fit your needs. config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig(); tcpIpConfig.setEnabled(true); tcpIpConfig.setMembers(singletonList("127.0.0.1")); return config; }
Example #17
Source File: CacheConfiguration.java From flair-engine with Apache License 2.0 | 5 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); /* Number of backups. If 1 is set as the backup-count for example, then all entries of the map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. */ mapConfig.setBackupCount(0); /* Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* Maximum size of the map. When max size is reached, map is evicted based on the policy defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default is 0. */ mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; }
Example #18
Source File: TestJetRunner.java From beam with Apache License 2.0 | 5 votes |
private static Collection<JetInstance> initMemberInstances( JetTestInstanceFactory internalFactory) { JetConfig config = new JetConfig() .configureHazelcast( c -> c.addMapConfig( new MapConfig("map") .setEventJournalConfig(new EventJournalConfig().setEnabled(true)))); return Arrays.asList(internalFactory.newMember(config), internalFactory.newMember(config)); }
Example #19
Source File: ClassLoadingTest.java From subzero with Apache License 2.0 | 5 votes |
@Test public void givenMemberHasClassLoaderConfigured_whenObjectIsStored_thenClassLoaderWillBeUsed() throws Exception { String mapName = randomMapName(); Config config = new Config(); SubZero.useAsGlobalSerializer(config); ClassLoader spyingClassLoader = createSpyingClassLoader(); config.setClassLoader(spyingClassLoader); config.addMapConfig(new MapConfig(mapName).setInMemoryFormat(OBJECT)); HazelcastInstance member = hazelcastFactory.newHazelcastInstance(config); IMap<Integer, Object> myMap = member.getMap(mapName); myMap.put(0, new MyClass()); verify(spyingClassLoader).loadClass("info.jerrinot.subzero.ClassLoadingTest$MyClass"); }
Example #20
Source File: _CacheConfiguration.java From jhipster-ribbon-hystrix with GNU General Public License v3.0 | 5 votes |
private MapConfig initializeClusteredSession(JHipsterProperties jHipsterProperties) { MapConfig mapConfig = new MapConfig(); mapConfig.setBackupCount(jHipsterProperties.getCache().getHazelcast().getBackupCount()); mapConfig.setTimeToLiveSeconds(jHipsterProperties.getCache().getTimeToLiveSeconds()); return mapConfig; }
Example #21
Source File: _CacheConfiguration.java From jhipster-ribbon-hystrix with GNU General Public License v3.0 | 5 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); /* Number of backups. If 1 is set as the backup-count for example, then all entries of the map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. */ mapConfig.setBackupCount(0); /* Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* Maximum size of the map. When max size is reached, map is evicted based on the policy defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default is 0. */ mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); /* When max. size is reached, specified percentage of the map will be evicted. Any integer between 0 and 100. If 25 is set for example, 25% of the entries will get evicted. */ mapConfig.setEvictionPercentage(25); return mapConfig; }
Example #22
Source File: HazelcastConfigSimple.java From hazelcast-demo with Apache License 2.0 | 5 votes |
public static void main(String[] args) { // 从classpath加载配置文件 Config config = new ClasspathXmlConfig("xmlconfig/simple-config.xml"); // 获取网络配置 NetworkConfig netConfig = config.getNetworkConfig(); // 获取用户定义的map配置 MapConfig mapConfigXml = config.getMapConfig("demo.config"); // 获取系统默认的map配置 MapConfig mapConfigDefault = config.getMapConfig("default"); // 输出集群监听的起始端口号 System.out.println("Current port:" + netConfig.getPort()); // 输出监听端口的累加号 System.out.println("Current port count:" + netConfig.getPortCount()); // 输出自定义map的备份副本个数 System.out.println("Config map backup count:" + mapConfigXml.getBackupCount()); // 输出默认map的备份副本个数 System.out.println("Default map backup count:" + mapConfigDefault.getBackupCount()); // 测试创建Hazelcast实例并读写测试数据 HazelcastInstance instance1 = Hazelcast.newHazelcastInstance(config); HazelcastInstance instance2 = Hazelcast.newHazelcastInstance(config); Map<Integer, String> defaultMap1 = instance1.getMap("defaultMap"); defaultMap1.put(1, "testMap"); Map<Integer, String> configMap1 = instance1.getMap("configMap"); configMap1.put(1, "configMap"); Map<Integer, String> testMap2 = instance2.getMap("defaultMap"); System.out.println("Default map value:" + testMap2.get(1)); Map<Integer, String> configMap2 = instance2.getMap("configMap"); System.out.println("Config map value:" + configMap2.get(1)); }
Example #23
Source File: StaticMapConfig.java From hazelcast-demo with Apache License 2.0 | 5 votes |
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)); }
Example #24
Source File: HazelcastSlidingWindowRequestRateLimiter.java From ratelimitj with Apache License 2.0 | 5 votes |
private IMap<String, Long> getMap(String key, int longestDuration) { MapConfig mapConfig = hz.getConfig().getMapConfig(key); mapConfig.setTimeToLiveSeconds(longestDuration); mapConfig.setAsyncBackupCount(1); mapConfig.setBackupCount(0); return hz.getMap(key); }
Example #25
Source File: ServiceCacheConfiguration.java From iotplatform with Apache License 2.0 | 5 votes |
private MapConfig createDeviceCredentialsCacheConfig() { MapConfig deviceCredentialsCacheConfig = new MapConfig(CacheConstants.DEVICE_CREDENTIALS_CACHE); deviceCredentialsCacheConfig.setTimeToLiveSeconds(cacheDeviceCredentialsTTL); deviceCredentialsCacheConfig.setEvictionPolicy(EvictionPolicy.LRU); deviceCredentialsCacheConfig.setMaxSizeConfig( new MaxSizeConfig( cacheDeviceCredentialsMaxSizeSize, MaxSizeConfig.MaxSizePolicy.valueOf(cacheDeviceCredentialsMaxSizePolicy)) ); return deviceCredentialsCacheConfig; }
Example #26
Source File: HazelcastSymmetric.java From Android_Code_Arbiter with GNU Lesser General Public License v3.0 | 5 votes |
public void init() { //Specific map time to live MapConfig myMapConfig = new MapConfig(); myMapConfig.setName("cachetest"); myMapConfig.setTimeToLiveSeconds(10); //Package config Config myConfig = new Config(); myConfig.addMapConfig(myMapConfig); //Symmetric Encryption SymmetricEncryptionConfig symmetricEncryptionConfig = new SymmetricEncryptionConfig(); symmetricEncryptionConfig.setAlgorithm("DESede"); symmetricEncryptionConfig.setSalt("saltysalt"); symmetricEncryptionConfig.setPassword("lamepassword"); symmetricEncryptionConfig.setIterationCount(1337); //Weak Network config.. NetworkConfig networkConfig = new NetworkConfig(); networkConfig.setSymmetricEncryptionConfig(symmetricEncryptionConfig); myConfig.setNetworkConfig(networkConfig); Hazelcast.init(myConfig); cacheMap = Hazelcast.getMap("cachetest"); }
Example #27
Source File: CachingConfig.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@Bean public Config hazelCastConfig() { Config config = new Config(); config.setInstanceName("hazelcast-packt-cache"); config.setProperty("hazelcast.jmx", "true"); MapConfig deptCache = new MapConfig(); deptCache.setTimeToLiveSeconds(20); deptCache.setEvictionPolicy(EvictionPolicy.LFU); config.getMapConfigs().put("hazeldept",deptCache); return config; }
Example #28
Source File: HazelCastConfigration.java From jvue-admin with MIT License | 5 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); mapConfig.setBackupCount(1); mapConfig.setEvictionPolicy(EvictionPolicy.LRU); mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; }
Example #29
Source File: CacheConfiguration.java From jhipster-microservices-example with Apache License 2.0 | 5 votes |
private MapConfig initializeDefaultMapConfig() { MapConfig mapConfig = new MapConfig(); /* Number of backups. If 1 is set as the backup-count for example, then all entries of the map will be copied to another JVM for fail-safety. Valid numbers are 0 (no backup), 1, 2, 3. */ mapConfig.setBackupCount(0); /* Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently Used). NONE is the default. */ mapConfig.setEvictionPolicy(EvictionPolicy.LRU); /* Maximum size of the map. When max size is reached, map is evicted based on the policy defined. Any integer between 0 and Integer.MAX_VALUE. 0 means Integer.MAX_VALUE. Default is 0. */ mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE)); return mapConfig; }
Example #30
Source File: PaasCloudMonitorApplication.java From paascloud-master with Apache License 2.0 | 5 votes |
/** * Hazelcast config config. * * @return the config */ @Bean public Config hazelcastConfig() { return new Config().setProperty("hazelcast.jmx", "true") .addMapConfig(new MapConfig("spring-boot-admin-application-store").setBackupCount(1) .setEvictionPolicy(EvictionPolicy.NONE)) .addListConfig(new ListConfig("spring-boot-admin-event-store").setBackupCount(1) .setMaxSize(1000)); }