Skip to content
Snippets Groups Projects
Commit 40b0e1c7 authored by Zhibin Mai's avatar Zhibin Mai
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
parent 8cffa975
No related branches found
No related tags found
1 merge request!572Implement Redis cache in Azure for two kinds of object caches that are...
Pipeline #196612 failed
...@@ -25,7 +25,7 @@ public class RecordChangeInfoCacheVmImpl implements IRecordChangeInfoCache { ...@@ -25,7 +25,7 @@ public class RecordChangeInfoCacheVmImpl implements IRecordChangeInfoCache {
private VmCache<String, RecordChangeInfo> cache; private VmCache<String, RecordChangeInfo> cache;
public RecordChangeInfoCacheVmImpl() { 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 @Override
......
...@@ -25,5 +25,6 @@ public class Constants { ...@@ -25,5 +25,6 @@ public class Constants {
// Data id itself is partition safe // Data id itself is partition safe
public static final int DATA_CACHE_EXPIRATION = 120; 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; public static final int DATA_MAX_CACHE_SIZE = 20000;
} }
...@@ -30,7 +30,7 @@ public class RecordChangeInfoRedisCache extends RedisCache<String, RecordChangeI ...@@ -30,7 +30,7 @@ public class RecordChangeInfoRedisCache extends RedisCache<String, RecordChangeI
public RecordChangeInfoRedisCache(final @Named("REDIS_HOST") String host, public RecordChangeInfoRedisCache(final @Named("REDIS_HOST") String host,
final @Named("REDIS_PORT") int port, final @Named("REDIS_PORT") int port,
final @Named("REDIS_PASSWORD") String password, 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) { @Value("${redis.database}") final int database) {
super(host, port, password, timeout, database, String.class, RecordChangeInfo.class); super(host, port, password, timeout, database, String.class, RecordChangeInfo.class);
} }
......
...@@ -41,6 +41,9 @@ public class RedisConfig { ...@@ -41,6 +41,9 @@ public class RedisConfig {
@Value("${redis.records.ttl:120}") @Value("${redis.records.ttl:120}")
public int recordsTtl; public int recordsTtl;
@Value("${redis.record.change.info.ttl:3600}")
public int recordChangeInfoTtl;
@Bean @Bean
@Named("REDIS_PORT") @Named("REDIS_PORT")
public int getRedisPort() { public int getRedisPort() {
...@@ -71,6 +74,12 @@ public class RedisConfig { ...@@ -71,6 +74,12 @@ public class RedisConfig {
return recordsTtl; return recordsTtl;
} }
@Bean
@Named("RECORD_CHANGE_INFO_REDIS_TTL")
public int getRecordChangeInfoRedisTtl() {
return recordChangeInfoTtl;
}
@Bean @Bean
@Named("REDIS_HOST") @Named("REDIS_HOST")
public String redisHost(SecretClient kv) { 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