diff --git a/app/collins/models/RemoteAssetFinder.scala b/app/collins/models/RemoteAssetFinder.scala index 60c5635ab..b98df3826 100644 --- a/app/collins/models/RemoteAssetFinder.scala +++ b/app/collins/models/RemoteAssetFinder.scala @@ -26,6 +26,7 @@ import collins.solr.SolrOrOp import collins.solr.StringValueFormat import collins.util.AttributeResolver.ResultTuple import collins.util.RemoteCollinsHost +import collins.util.config.MultiCollinsConfig /** * Just a combination of everything needed to do a search. Probably should @@ -279,7 +280,8 @@ object RemoteAssetFinder { val key = searchParams.paginationKey.getOrElse("") + clients.map { _.tag }.mkString("_") val stream = Cache.getAs[RemoteAssetStream](key).getOrElse(new RemoteAssetStream(clients, searchParams)) val results = stream.slice(pageParams.page * pageParams.size, (pageParams.page + 1) * (pageParams.size)) - Cache.set(key, stream, 30) + val timeout = MultiCollinsConfig.queryCacheTimeout + Cache.set(key, stream, timeout) (results, stream.aggregateTotal) } diff --git a/app/collins/util/config/MultiCollinsConfig.scala b/app/collins/util/config/MultiCollinsConfig.scala index 1da319cf5..c04163ac2 100644 --- a/app/collins/util/config/MultiCollinsConfig.scala +++ b/app/collins/util/config/MultiCollinsConfig.scala @@ -18,6 +18,7 @@ object MultiCollinsConfig extends Configurable { } def locationAttribute = getString("locationAttribute", "LOCATION") def thisInstance = getString("thisInstance") + def queryCacheTimeout = getInt("queryCacheTimeout", 30) override def validateConfig() { if (enabled) { diff --git a/conf/reference/multicollins_reference.conf b/conf/reference/multicollins_reference.conf index 40e50bb95..f9be8a49d 100644 --- a/conf/reference/multicollins_reference.conf +++ b/conf/reference/multicollins_reference.conf @@ -3,4 +3,5 @@ multicollins { instanceAssetType = DATA_CENTER locationAttribute = LOCATION thisInstance = NONE + queryCacheTimeout = 30 }