You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/11/12 05:12:55 UTC

[GitHub] chetanmeh commented on a change in pull request #4104: Cache empty auth results to reduce db load

chetanmeh commented on a change in pull request #4104: Cache empty auth results to reduce db load
URL: https://github.com/apache/incubator-openwhisk/pull/4104#discussion_r232536376
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/core/database/MultipleReadersSingleWriterCache.scala
 ##########
 @@ -445,25 +444,37 @@ trait MultipleReadersSingleWriterCache[W, Winfo] {
   }
 
   /** This is the backing store. */
-  private lazy val cache: ConcurrentMapBackedCache[Entry] = evictionPolicy match {
-    case AccessTime =>
-      new ConcurrentMapBackedCache(
-        Caffeine
+  private lazy val cache: ConcurrentMapBackedCache[Entry] = new ConcurrentMapBackedCache(
 
 Review comment:
   This can be simplified a bit
   ```suggestion
       private lazy val cache: ConcurrentMapBackedCache[Entry] = createCache()
   
     private def createCache() = {
       val b = Caffeine
         .newBuilder()
         .softValues()
   
       evictionPolicy match {
         case AccessTime => b.expireAfterAccess(5, TimeUnit.MINUTES)
         case _          => b.expireAfterWrite(5, TimeUnit.MINUTES)
       }
   
       if (fixedCacheSize > 0) b.maximumSize(fixedCacheSize)
       new ConcurrentMapBackedCache(b.build().asMap().asInstanceOf[ConcurrentMap[Any, Future[Entry]]])
     }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services