Merge "config: Use less generic cache key, and not fragmented by wiki"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 1 May 2017 23:31:21 +0000 (23:31 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 1 May 2017 23:31:21 +0000 (23:31 +0000)
includes/config/EtcdConfig.php

index f226f17..fd5c3f7 100644 (file)
@@ -54,8 +54,6 @@ class EtcdConfig implements Config, LoggerAwareInterface {
        private $skewCacheTTL;
        /** @var integer */
        private $timeout;
-       /** @var string */
-       private $directoryHash;
 
        /**
         * @param array $params Parameter map:
@@ -81,7 +79,6 @@ class EtcdConfig implements Config, LoggerAwareInterface {
                $this->host = $params['host'];
                $this->protocol = $params['protocol'];
                $this->directory = trim( $params['directory'], '/' );
-               $this->directoryHash = sha1( $this->directory );
                $this->encoding = $params['encoding'];
                $this->skewCacheTTL = $params['skewTTL'];
                $this->baseCacheTTL = max( $params['cacheTTL'] - $this->skewCacheTTL, 0 );
@@ -131,7 +128,11 @@ class EtcdConfig implements Config, LoggerAwareInterface {
                }
 
                $now = microtime( true );
-               $key = $this->srvCache->makeKey( 'variable', $this->directoryHash );
+               $key = $this->srvCache->makeGlobalKey(
+                       __CLASS__,
+                       $this->host,
+                       $this->directory
+               );
 
                // Get the cached value or block until it is regenerated (by this or another thread)...
                $data = null; // latest config info