I am using hazelcast 3.9 with spring boot as a caching backend, and using multiple distributed maps as the datastructure for caching. Most config parameters for the maps are common, like backup count, eviction policy etc, but some can be different, like time to live.
Is there away using which I can have a common map configuration that I can use as reference in configs of different maps?
I found some people using <map name="default"> in some open source repos, and it looked like they expect this config to be overridden by other map configs, but it is not working for me.
This is the config I am using currently:
<?xml version="1.0" encoding="UTF-8"?>
<hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config https://hazelcast.com/schema/config/hazelcast-config-3.9.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
<name>something</name>
<password>something</password>
</group>
<properties>
<property name="hazelcast.partition.count">83</property>
</properties>
<management-center enabled="true" update-interval="3">http://localhost:8081/mancenter</management-center>
<network>
<join>
<multicast enabled="true"/>
</join>
</network>
<map name="map1">
<!--<max-size policy="PER_NODE">273</max-size>-->
<max-size policy="USED_HEAP_PERCENTAGE">20</max-size>
<eviction-policy>LFU</eviction-policy>
<statistics-enabled>true</statistics-enabled>
<backup-count>0</backup-count>
<async-backup-count>1</async-backup-count>
<read-backup-data>true</read-backup-data>
<time-to-live-seconds>10800</time-to-live-seconds> <!--3 hours-->
</map>
<map name="map2">
<!--<max-size policy="PER_NODE">273</max-size>-->
<max-size policy="USED_HEAP_PERCENTAGE">20</max-size>
<eviction-policy>LFU</eviction-policy>
<statistics-enabled>true</statistics-enabled>
<backup-count>0</backup-count>
<async-backup-count>1</async-backup-count>
<read-backup-data>true</read-backup-data>
<time-to-live-seconds>86400</time-to-live-seconds> <!--24 hours-->
</map>
</hazelcast>
I am not very familiar with using xmls, but I tried to find some way to refer xml elements in other xml elements, but that doesn't seem to be working either. Looks like DOCTYPE attribute isn't allowed in hazelcast config schema.
I also want to avoid hazelcast configuration through code.