This is an automated email from the ASF dual-hosted git repository.
tysonnorris pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new 00642f7 Make cache expiration time configurable (#5076)
00642f7 is described below
commit 00642f737708cdbb82bd88cb74c4bdb109f4b6b0
Author: Félix Delval <[email protected]>
AuthorDate: Wed Mar 10 17:24:06 2021 +0100
Make cache expiration time configurable (#5076)
---
.../openwhisk/core/database/MultipleReadersSingleWriterCache.scala | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/common/scala/src/main/scala/org/apache/openwhisk/core/database/MultipleReadersSingleWriterCache.scala
b/common/scala/src/main/scala/org/apache/openwhisk/core/database/MultipleReadersSingleWriterCache.scala
index 7de4f3b..5856659 100644
---
a/common/scala/src/main/scala/org/apache/openwhisk/core/database/MultipleReadersSingleWriterCache.scala
+++
b/common/scala/src/main/scala/org/apache/openwhisk/core/database/MultipleReadersSingleWriterCache.scala
@@ -94,6 +94,8 @@ trait MultipleReadersSingleWriterCache[W, Winfo] {
/** Subclasses: Toggle this to enable/disable caching for your entity type.
*/
protected val cacheEnabled = true
protected val evictionPolicy: EvictionPolicy = AccessTime
+ protected val cacheExpirationTime: Long = 5
+ protected val cacheExpirationTimeUnit: TimeUnit = TimeUnit.MINUTES
protected val fixedCacheSize = 0
private object Entry {
@@ -452,8 +454,8 @@ trait MultipleReadersSingleWriterCache[W, Winfo] {
.softValues()
evictionPolicy match {
- case AccessTime => b.expireAfterAccess(5, TimeUnit.MINUTES)
- case _ => b.expireAfterWrite(5, TimeUnit.MINUTES)
+ case AccessTime => b.expireAfterAccess(cacheExpirationTime,
cacheExpirationTimeUnit)
+ case _ => b.expireAfterWrite(cacheExpirationTime,
cacheExpirationTimeUnit)
}
if (fixedCacheSize > 0) b.maximumSize(fixedCacheSize)