Avoid key fragmentation in FileBackend
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 24 Feb 2014 21:22:15 +0000 (13:22 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 24 Feb 2014 21:22:15 +0000 (13:22 -0800)
* Make sure that global backends do not prefix the cache keys
  with local wiki IDs for container and file stat entries.
  This causes fragmentation and breaks invalidation.

Change-Id: Ic02d6e41f828dc82cc07c7d24c8af29c46392a9c

includes/filebackend/FileBackendStore.php

index 9a2ebb7..16300af 100644 (file)
@@ -1565,7 +1565,7 @@ abstract class FileBackendStore extends FileBackend {
         * @return string
         */
        private function containerCacheKey( $container ) {
-               return wfMemcKey( 'backend', $this->getName(), 'container', $container );
+               return "filebackend:{$this->name}:{$this->wikiId}:container:{$container}";
        }
 
        /**
@@ -1646,7 +1646,7 @@ abstract class FileBackendStore extends FileBackend {
         * @return string
         */
        private function fileCacheKey( $path ) {
-               return wfMemcKey( 'backend', $this->getName(), 'file', sha1( $path ) );
+               return "filebackend:{$this->name}:{$this->wikiId}:file:" . sha1( $path );
        }
 
        /**