Commit 49722744 authored by Matija Obreza's avatar Matija Obreza
Browse files

cache.defaultCacheSize in spring.properties

parent 68493d43
......@@ -43,6 +43,9 @@ public abstract class HazelcastConfig {
@Value("${hazelcast.name}")
protected String name;
@Value("${cache.defaultCacheSize}")
protected int defaultCacheSize;
@Value("${cache.tileserver.max-size}")
protected int tileserverMaxSize;
@Value("${cache.tileserver.max-idle-seconds}")
......
......@@ -23,6 +23,7 @@ import org.springframework.context.annotation.Profile;
import com.hazelcast.config.AwsConfig;
import com.hazelcast.config.Config;
import com.hazelcast.config.EvictionPolicy;
import com.hazelcast.config.ExecutorConfig;
import com.hazelcast.config.GroupConfig;
import com.hazelcast.config.JoinConfig;
......@@ -77,6 +78,17 @@ public class HazelcastConfigAWS extends HazelcastConfig {
awsConfig.setConnectionTimeoutSeconds(20);
awsConfig.setSecurityGroupName(securityGroupName);
MapConfig defaultMapConfig = new MapConfig();
defaultMapConfig.setName("default");
// defaultMapConfig.setTimeToLiveSeconds(0);
defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU);
// defaultMapConfig.setMaxIdleSeconds();
MaxSizeConfig defaultMaxSizeConfig = new MaxSizeConfig();
defaultMaxSizeConfig.setSize(defaultCacheSize);
defaultMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(defaultMaxSizeConfig);
cfg.addMapConfig(defaultMapConfig);
MapConfig tileserverMapConfig = new MapConfig();
tileserverMapConfig.setName("tileserver");
tileserverMapConfig.setTimeToLiveSeconds(tileserverTTL);
......
......@@ -72,7 +72,7 @@ public class HazelcastConfigCacher extends HazelcastConfig {
defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU);
// defaultMapConfig.setMaxIdleSeconds();
MaxSizeConfig defaultMaxSizeConfig = new MaxSizeConfig();
defaultMaxSizeConfig.setSize(2000);
defaultMaxSizeConfig.setSize(defaultCacheSize);
defaultMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(defaultMaxSizeConfig);
cfg.addMapConfig(defaultMapConfig);
......
......@@ -68,7 +68,7 @@ public class HazelcastConfigDev extends HazelcastConfig {
defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU);
// defaultMapConfig.setMaxIdleSeconds();
MaxSizeConfig defaultMaxSizeConfig = new MaxSizeConfig();
defaultMaxSizeConfig.setSize(2000);
defaultMaxSizeConfig.setSize(defaultCacheSize);
defaultMaxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
defaultMapConfig.setMaxSizeConfig(defaultMaxSizeConfig);
cfg.addMapConfig(defaultMapConfig);
......
......@@ -117,6 +117,7 @@ scheduler.tokens.cleanup.hours=1
tileserver.cdn='http://localhost:8080'
# TileServer Cache
cache.defaultCacheSize=5000
cache.tileserver.max-size=1000
cache.tileserver.time-to-live-seconds=300
cache.tileserver.max-idle-seconds=0
......
......@@ -86,6 +86,7 @@ hazelcast.aws.region=eu-west-1
hazelcast.aws.security-group=sg-hazelcast
# TileServer Cache
cache.defaultCacheSize=1000
cache.tileserver.max-size=1000
cache.tileserver.time-to-live-seconds=300
cache.tileserver.max-idle-seconds=0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment