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

Default caching configuration with idle time 10 min, max age 1 hour

parent c5f6e704
......@@ -66,19 +66,15 @@ public abstract class HazelcastConfig {
@Value("${cache.defaultCacheSize}")
protected int defaultCacheSize;
@Value("${cache.time-to-live-seconds}")
private int defaultTimeToLiveSeconds;
private int cacheTimeToLiveSeconds;
@Value("${cache.max-idle-seconds}")
private int defaultMaxIdleSeconds;
@Value("${cache.tileserver.max-size}")
protected int tileserverMaxSize;
@Value("${cache.tileserver.max-idle-seconds}")
protected int tileserverMaxIdle;
@Value("${cache.tileserver.time-to-live-seconds}")
protected int tileserverTTL;
@Value("${cache.tileserver.eviction-policy}")
protected EvictionPolicy tileserverEvictionPolicy;
private int cacheMaxIdleSeconds;
@Value("${cache.eviction-policy}")
protected EvictionPolicy cacheEvictionPolicy;
@Bean
public ManagedContext managedContext() {
......@@ -127,8 +123,8 @@ public abstract class HazelcastConfig {
protected void configureHazelcast(Config cfg) {
MapConfig defaultMapConfig = new MapConfig();
defaultMapConfig.setName("default");
defaultMapConfig.setTimeToLiveSeconds(defaultTimeToLiveSeconds);
defaultMapConfig.setMaxIdleSeconds(defaultMaxIdleSeconds);
defaultMapConfig.setTimeToLiveSeconds(cacheTimeToLiveSeconds);
defaultMapConfig.setMaxIdleSeconds(cacheMaxIdleSeconds);
defaultMapConfig.setEvictionPolicy(EvictionPolicy.LFU);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
......@@ -140,28 +136,12 @@ public abstract class HazelcastConfig {
MapConfig tileserverMapConfig = new MapConfig();
tileserverMapConfig.setName("tileserver");
tileserverMapConfig.setTimeToLiveSeconds(tileserverTTL);
tileserverMapConfig.setEvictionPolicy(tileserverEvictionPolicy);
tileserverMapConfig.setMaxIdleSeconds(tileserverMaxIdle);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(tileserverMaxSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
tileserverMapConfig.setMaxSizeConfig(maxSizeConfig);
}
tileserverMapConfig.setMaxIdleSeconds(60 * 60 * 3); // 3 hours
cfg.addMapConfig(tileserverMapConfig);
MapConfig jettySessionsMapConfig = new MapConfig();
jettySessionsMapConfig.setName("jetty-sessions");
jettySessionsMapConfig.setTimeToLiveSeconds(60 * 60 * 24); // 1 day
jettySessionsMapConfig.setEvictionPolicy(tileserverEvictionPolicy);
jettySessionsMapConfig.setMaxIdleSeconds(tileserverMaxIdle);
{
MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
maxSizeConfig.setSize(tileserverMaxSize);
maxSizeConfig.setMaxSizePolicy(MaxSizePolicy.PER_NODE);
jettySessionsMapConfig.setMaxSizeConfig(maxSizeConfig);
}
cfg.addMapConfig(jettySessionsMapConfig);
ExecutorConfig execConfig = new ExecutorConfig();
......
......@@ -134,15 +134,12 @@ scheduler.tokens.cleanup.hours=1
tileserver.cdn='${base.url}'
# TileServer Cache
cache.defaultCacheSize=5000
# 300 / 60 = 5min
cache.time-to-live-seconds=300
# 120 / 60 = 2min
cache.max-idle-seconds=120
cache.tileserver.max-size=1000
cache.tileserver.time-to-live-seconds=300
cache.tileserver.max-idle-seconds=0
cache.tileserver.eviction-policy=LRU
cache.defaultCacheSize=2000
cache.eviction-policy=LRU
# 1 hour - revalidate frequently used entries
cache.time-to-live-seconds=3600
# 10 min
cache.max-idle-seconds=600
# Connection to Elasticsearch
elasticsearch.cluster.name=es-genesys-development
......
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