Skip to content

Commit

Permalink
Merge pull request #437 from tumblr/will-option-to-disable-multicolli…
Browse files Browse the repository at this point in the history
…ns-cache

Add a parameter to disable the multicollins cache
  • Loading branch information
william-richard committed Apr 19, 2016
2 parents a323935 + 52af695 commit 8c02e52
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/collins/models/RemoteAssetFinder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ object RemoteAssetFinder {
val stream = Cache.getAs[RemoteAssetStream](key).getOrElse(new RemoteAssetStream(clients, searchParams))
val results = stream.slice(pageParams.page * pageParams.size, (pageParams.page + 1) * (pageParams.size))
val timeout = MultiCollinsConfig.queryCacheTimeout
Cache.set(key, stream, timeout)
if (MultiCollinsConfig.cacheEnabled) {
Cache.set(key, stream, timeout)
}
(results, stream.aggregateTotal)
}

Expand Down
1 change: 1 addition & 0 deletions app/collins/util/config/MultiCollinsConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ object MultiCollinsConfig extends Configurable {
def locationAttribute = getString("locationAttribute", "LOCATION")
def thisInstance = getString("thisInstance")
def queryCacheTimeout = getInt("queryCacheTimeout", 30)
def cacheEnabled = getBoolean("cacheEnabled", true)

override def validateConfig() {
if (enabled) {
Expand Down
1 change: 1 addition & 0 deletions conf/reference/multicollins_reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ multicollins {
locationAttribute = LOCATION
thisInstance = NONE
queryCacheTimeout = 30
cacheEnabled = true
}

0 comments on commit 8c02e52

Please sign in to comment.