Add property for cached search result timeout

This commit is contained in:
James Agnew
2019-11-22 16:00:49 +01:00
parent 528563881f
commit 06765640e2
3 changed files with 14 additions and 4 deletions

View File

@@ -105,6 +105,9 @@ public class FhirServerConfigCommon {
retVal.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsMillis);
ourLog.info("Server configured to cache search results for {} milliseconds", reuseCachedSearchResultsMillis);
Long retainCachedSearchesMinutes = HapiProperties.getExpireSearchResultsAfterMins();
retVal.setExpireSearchResultsAfterMillis(retainCachedSearchesMinutes * 60 * 1000);
// Subscriptions are enabled by channel type
if (HapiProperties.getSubscriptionRestHookEnabled()) {
ourLog.info("Enabling REST-hook subscriptions");

View File

@@ -20,7 +20,7 @@ import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringUtils.*;
public class HapiProperties {
static final String ENABLE_INDEX_MISSING_FIELDS = "enable_index_missing_fields";
static final String ENABLE_INDEX_MISSING_FIELDS = "enable_index_missing_fields";
static final String AUTO_CREATE_PLACEHOLDER_REFERENCE_TARGETS = "auto_create_placeholder_reference_targets";
static final String ENFORCE_REFERENTIAL_INTEGRITY_ON_WRITE = "enforce_referential_integrity_on_write";
static final String ENFORCE_REFERENTIAL_INTEGRITY_ON_DELETE = "enforce_referential_integrity_on_delete";
@@ -67,7 +67,8 @@ public class HapiProperties {
private static final String FILTER_SEARCH_ENABLED = "filter_search.enabled";
private static final String GRAPHQL_ENABLED = "graphql.enabled";
private static final String BULK_EXPORT_ENABLED = "bulk.export.enabled";
private static Properties ourProperties;
public static final String EXPIRE_SEARCH_RESULTS_AFTER_MINS = "retain_cached_searches_mins";
private static Properties ourProperties;
public static boolean isElasticSearchEnabled() {
return HapiProperties.getPropertyBoolean("elasticsearch.enabled", false);
@@ -395,10 +396,15 @@ public class HapiProperties {
}
public static Long getReuseCachedSearchResultsMillis() {
String value = HapiProperties.getProperty(REUSE_CACHED_SEARCH_RESULTS_MILLIS, "-1");
String value = HapiProperties.getProperty(REUSE_CACHED_SEARCH_RESULTS_MILLIS, "60000");
return Long.valueOf(value);
}
public static Long getExpireSearchResultsAfterMins() {
String value = HapiProperties.getProperty(EXPIRE_SEARCH_RESULTS_AFTER_MINS, "60");
return Long.valueOf(value);
}
public static Boolean getCorsAllowedCredentials() {
return HapiProperties.getBooleanProperty(CORS_ALLOW_CREDENTIALS, false);
}

View File

@@ -19,7 +19,8 @@ enforce_referential_integrity_on_write=false
enforce_referential_integrity_on_delete=false
default_encoding=JSON
etag_support=ENABLED
reuse_cached_search_results_millis=-1
reuse_cached_search_results_millis=60000
retain_cached_searches_mins=60
default_page_size=20
max_page_size=200
allow_override_default_search_params=true