diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/model/Constants.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/model/Constants.java index 91017c2fe1fbfa1773fcd611773849e47a889d5c..2153c214cd09222a98d77e0831f904f1babe6238 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/model/Constants.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/model/Constants.java @@ -21,9 +21,9 @@ public class Constants { // Specifications using kind as key is not partition safe if the specifications are per data partition public static final int SPEC_CACHE_EXPIRATION = 600; - public static final int SPEC_MAX_CACHE_SIZE = 2000; + public static final int SPEC_MAX_CACHE_SIZE = 20000; // Data id itself is partition safe public static final int DATA_CACHE_EXPIRATION = 120; - public static final int DATA_MAX_CACHE_SIZE = 2000; + public static final int DATA_MAX_CACHE_SIZE = 20000; } diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/cache/RecordChangeInfoRedisCache.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/cache/RecordChangeInfoRedisCache.java new file mode 100644 index 0000000000000000000000000000000000000000..ce64672903d1275e614862905bae1cdf93ec9091 --- /dev/null +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/cache/RecordChangeInfoRedisCache.java @@ -0,0 +1,23 @@ +package org.opengroup.osdu.indexer.azure.cache; + +import org.opengroup.osdu.core.common.cache.RedisCache; +import org.opengroup.osdu.indexer.cache.IRecordChangeInfoCache; +import org.opengroup.osdu.indexer.model.RecordChangeInfo; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.stereotype.Component; + +import javax.inject.Named; + +@Component +@ConditionalOnProperty(value = "runtime.env.local", havingValue = "false", matchIfMissing = true) +public class RecordChangeInfoRedisCache extends RedisCache<String, RecordChangeInfo> implements IRecordChangeInfoCache { + 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, + @Qualifier("") @Value("${redis.database}") final int database) { + super(host, port, password, timeout, database, String.class, RecordChangeInfo.class); + } +} diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/cache/RelatedObjectRedisCache.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/cache/RelatedObjectRedisCache.java new file mode 100644 index 0000000000000000000000000000000000000000..e36c071c5a51f5e7e82e55f15b7a0bd22f3b5c4f --- /dev/null +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/cache/RelatedObjectRedisCache.java @@ -0,0 +1,23 @@ +package org.opengroup.osdu.indexer.azure.cache; + +import org.opengroup.osdu.core.common.cache.RedisCache; +import org.opengroup.osdu.core.common.model.storage.RecordData; +import org.opengroup.osdu.indexer.cache.IRelatedObjectCache; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.stereotype.Component; + +import javax.inject.Named; + +@Component +@ConditionalOnProperty(value = "runtime.env.local", havingValue = "false", matchIfMissing = true) +public class RelatedObjectRedisCache extends RedisCache<String, RecordData> implements IRelatedObjectCache { + public RelatedObjectRedisCache(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, + @Qualifier("") @Value("${redis.database}") final int database) { + super(host, port, password, timeout, database, String.class, RecordData.class); + } +} diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/di/RedisConfig.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/di/RedisConfig.java index 6b98eb7ce0eb6f54dff8cb13279224b91add958f..8ed9134f0ca96064f0977f16b6e36c6289d39d6c 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/di/RedisConfig.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/di/RedisConfig.java @@ -38,6 +38,9 @@ public class RedisConfig { @Value("${redis.schema.ttl:3600}") public int schemaTtl; + @Value("${redis.records.ttl:120}") + public int recordsTtl; + @Bean @Named("REDIS_PORT") public int getRedisPort() { @@ -62,6 +65,12 @@ public class RedisConfig { return schemaTtl; } + @Bean + @Named("RECORDS_REDIS_TTL") + public int getRecordsRedisTtl() { + return recordsTtl; + } + @Bean @Named("REDIS_HOST") public String redisHost(SecretClient kv) {