From d403f4fc3022977e758b4a50d7ac67a619a3e4f4 Mon Sep 17 00:00:00 2001
From: zhijie wang <wanzhiji@amazon.com>
Date: Fri, 20 Aug 2021 22:51:41 -0700
Subject: [PATCH] update

---
 .../osdu/indexer/aws/cache/SchemaCacheImpl.java       | 11 +++++------
 .../src/main/resources/application.properties         |  3 ---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/provider/indexer-aws/src/main/java/org/opengroup/osdu/indexer/aws/cache/SchemaCacheImpl.java b/provider/indexer-aws/src/main/java/org/opengroup/osdu/indexer/aws/cache/SchemaCacheImpl.java
index c8c13a334..ae300d950 100644
--- a/provider/indexer-aws/src/main/java/org/opengroup/osdu/indexer/aws/cache/SchemaCacheImpl.java
+++ b/provider/indexer-aws/src/main/java/org/opengroup/osdu/indexer/aws/cache/SchemaCacheImpl.java
@@ -14,6 +14,9 @@
 
 package org.opengroup.osdu.indexer.aws.cache;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.opengroup.osdu.core.aws.cache.AwsElasticCache;
+import org.opengroup.osdu.core.aws.ssm.K8sParameterNotFoundException;
 import org.opengroup.osdu.core.common.cache.ICache;
 import org.opengroup.osdu.core.common.cache.RedisCache;
 import org.opengroup.osdu.indexer.provider.interfaces.ISchemaCache;
@@ -25,12 +28,8 @@ public class SchemaCacheImpl implements ISchemaCache<String, String>, AutoClosea
 
     private ICache<String, String> cache;
     private Boolean local = false;
-    public SchemaCacheImpl(@Value("${aws.elasticache.cluster.endpoint}") final String REDIS_SEARCH_HOST,
-                       @Value("${aws.elasticache.cluster.port}") final String REDIS_SEARCH_PORT,
-                       @Value("${aws.elasticache.cluster.key}") final String REDIS_SEARCH_KEY,
-                       @Value("${aws.elasticache.cluster.schema.expiration}") final String SCHEMA_CACHE_EXPIRATION) {
-        cache = new RedisCache<>(REDIS_SEARCH_HOST, Integer.parseInt(REDIS_SEARCH_PORT), REDIS_SEARCH_KEY,
-                Integer.parseInt(SCHEMA_CACHE_EXPIRATION) * 60, String.class, String.class);
+    public SchemaCacheImpl(@Value("${aws.elasticache.cluster.schema.expiration}") final String SCHEMA_CACHE_EXPIRATION) throws K8sParameterNotFoundException, JsonProcessingException {
+        cache = AwsElasticCache.RedisCache(Integer.parseInt(SCHEMA_CACHE_EXPIRATION) * 60, String.class, String.class);
         if (cache.getClass() == RedisCache.class){
             local = false;
         }else{
diff --git a/provider/indexer-aws/src/main/resources/application.properties b/provider/indexer-aws/src/main/resources/application.properties
index 27054c982..cf570905d 100644
--- a/provider/indexer-aws/src/main/resources/application.properties
+++ b/provider/indexer-aws/src/main/resources/application.properties
@@ -32,9 +32,6 @@ STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST=${STORAGE_BASE_URL}/api/storage/v2/quer
 STORAGE_RECORDS_BATCH_SIZE=20
 INDEXER_QUEUE_HOST=""
 ## AWS ElastiCache configuration
-aws.elasticache.cluster.endpoint=${CACHE_CLUSTER_ENDPOINT}
-aws.elasticache.cluster.port=${CACHE_CLUSTER_PORT}
-aws.elasticache.cluster.key=${CACHE_CLUSTER_KEY}
 
 ## Cache Settings
 aws.elasticache.cluster.index.expiration=60
-- 
GitLab