Skip to content
Snippets Groups Projects
Commit 87f676ae authored by Zhibin Mai's avatar Zhibin Mai Committed by Chad Leong
Browse files

Split the ttl of records and record change info and increase the ttl of the...

Split the ttl of records and record change info and increase the ttl of the record change info to reduce the chance of the unnecessary indexing chasing

(cherry picked from commit 40b0e1c7)
parent 6062fc6a
No related branches found
No related tags found
1 merge request!582Cherry-pick 'Implement Redis cache in Azure for two kinds of object caches that are...' into release/0.22
......@@ -25,7 +25,7 @@ public class RecordChangeInfoCacheVmImpl implements IRecordChangeInfoCache {
private VmCache<String, RecordChangeInfo> cache;
public RecordChangeInfoCacheVmImpl() {
cache = new VmCache<>(Constants.DATA_CACHE_EXPIRATION, Constants.DATA_MAX_CACHE_SIZE);
cache = new VmCache<>(Constants.DATA_CHANGE_INFO_CACHE_EXPIRATION, Constants.DATA_MAX_CACHE_SIZE);
}
@Override
......
......@@ -25,5 +25,6 @@ public class Constants {
// Data id itself is partition safe
public static final int DATA_CACHE_EXPIRATION = 120;
public static final int DATA_CHANGE_INFO_CACHE_EXPIRATION = 3600;
public static final int DATA_MAX_CACHE_SIZE = 20000;
}
......@@ -30,7 +30,7 @@ public class RecordChangeInfoRedisCache extends RedisCache<String, RecordChangeI
public RecordChangeInfoRedisCache(final @Named("REDIS_HOST") String host,
final @Named("REDIS_PORT") int port,
final @Named("REDIS_PASSWORD") String password,
final @Named("RECORDS_REDIS_TTL") int timeout,
final @Named("RECORD_CHANGE_INFO_REDIS_TTL") int timeout,
@Value("${redis.database}") final int database) {
super(host, port, password, timeout, database, String.class, RecordChangeInfo.class);
}
......
......@@ -41,6 +41,9 @@ public class RedisConfig {
@Value("${redis.records.ttl:120}")
public int recordsTtl;
@Value("${redis.record.change.info.ttl:3600}")
public int recordChangeInfoTtl;
@Bean
@Named("REDIS_PORT")
public int getRedisPort() {
......@@ -71,6 +74,12 @@ public class RedisConfig {
return recordsTtl;
}
@Bean
@Named("RECORD_CHANGE_INFO_REDIS_TTL")
public int getRecordChangeInfoRedisTtl() {
return recordChangeInfoTtl;
}
@Bean
@Named("REDIS_HOST")
public String redisHost(SecretClient kv) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment