aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
authorBenjamin, Max <max.benjamin@att.com>2020-11-19 18:12:50 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-11-19 18:12:51 -0500
commita16231657fe29334a589c98290ac8b6b2710a144 (patch)
tree475dc51d396789aff10d5a63143350a4b8a2d762 /mso-api-handlers/mso-api-handler-infra
parentb029a27f327851e73ceff94595cbb1e099da8998 (diff)
add caching to graph inventory client
add caching to graph inventory client updated properties files to read cache properties Issue-ID: SO-3398 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ib3e67ae014b6668c9b004aae1e8b5d49b9ce6b06
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
index 6e6a9d2b07..1492baf1cd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
@@ -24,6 +24,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import org.onap.aaiclient.client.aai.AAIProperties;
import org.onap.aaiclient.client.aai.AAIVersion;
+import org.onap.so.client.CacheProperties;
import org.onap.so.spring.SpringContextHelper;
import org.springframework.context.ApplicationContext;
@@ -33,6 +34,8 @@ public class AaiClientPropertiesImpl implements AAIProperties {
private String auth;
private String key;
private Long readTimeout;
+ private boolean enableCaching;
+ private Long cacheMaxAge;
public AaiClientPropertiesImpl() {
@@ -41,6 +44,8 @@ public class AaiClientPropertiesImpl implements AAIProperties {
this.auth = context.getEnvironment().getProperty("aai.auth");
this.key = context.getEnvironment().getProperty("mso.msoKey");
this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, new Long(60000));
+ this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false);
+ this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L);
}
@Override
@@ -72,4 +77,19 @@ public class AaiClientPropertiesImpl implements AAIProperties {
public Long getReadTimeout() {
return this.readTimeout;
}
+
+ @Override
+ public boolean isCachingEnabled() {
+ return this.enableCaching;
+ }
+
+ @Override
+ public CacheProperties getCacheProperties() {
+ return new AAICacheProperties() {
+ @Override
+ public Long getMaxAge() {
+ return cacheMaxAge;
+ }
+ };
+ }
}