markusthoemmes commented on a change in pull request #2338: Prepare cache to 
change it by configuration
URL: 
https://github.com/apache/incubator-openwhisk/pull/2338#discussion_r131658957
 
 

 ##########
 File path: 
common/scala/src/main/scala/whisk/core/database/CouchDbStoreProvider.scala
 ##########
 @@ -23,20 +23,25 @@ import whisk.common.Logging
 import whisk.core.WhiskConfig
 import whisk.spi.Dependencies
 import whisk.spi.SpiFactory
+import whisk.core.entity.DocInfo
 
 /**
  * A CouchDB implementation of ArtifactStoreProvider
  */
 class CouchDbStoreProvider extends ArtifactStoreProvider {
-    def makeStore[D <: DocumentSerializer](config: WhiskConfig, name: 
WhiskConfig => String)(
+    def makeStore[D <: DocumentSerializer, CacheAbstraction](config: 
WhiskConfig, name: WhiskConfig => String, cache: 
Option[WhiskCache[CacheAbstraction, DocInfo]])(
         implicit jsonFormat: RootJsonFormat[D],
         actorSystem: ActorSystem,
-        logging: Logging): ArtifactStore[D] = {
+        logging: Logging): ArtifactStore[D, CacheAbstraction] = {
         require(config != null && config.isValid, "config is undefined or not 
valid")
         require(config.dbProvider == "Cloudant" || config.dbProvider == 
"CouchDB", "Unsupported db.provider: " + config.dbProvider)
         assume(Set(config.dbProtocol, config.dbHost, config.dbPort, 
config.dbUsername, config.dbPassword, name(config)).forall(_.nonEmpty), "At 
least one expected property is missing")
 
-        new CouchDbRestStore[D](config.dbProtocol, config.dbHost, 
config.dbPort.toInt, config.dbUsername, config.dbPassword, name(config))
+        new CouchDbRestStore[D, CacheAbstraction](config.dbProtocol, 
config.dbHost, config.dbPort.toInt, config.dbUsername, config.dbPassword, 
name(config), cache)
+    }
+
+    def makeCache[CacheAbstraction](): WhiskCache[CacheAbstraction, DocInfo] = 
{
+        new MultipleReadersSingleWriterCache[CacheAbstraction, DocInfo]()
 
 Review comment:
   Should we move this implementation to `ArtifactStoreProvider`? After all, 
it's not relying on implementation details.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to