Do not bother with WAN cache set options for immutable text blob keys
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 6 Mar 2019 22:19:41 +0000 (14:19 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 6 Mar 2019 22:33:04 +0000 (22:33 +0000)
Doing so can only result in occasional needless set() call rejections
or automatically lowered TTLs.

Change-Id: I2f007ba88e8f9c9f1ac3cd3d2daf3cd2289e315a

includes/Storage/SqlBlobStore.php

index d7216c5..a5c5985 100644 (file)
@@ -35,7 +35,6 @@ use Language;
 use MWException;
 use WANObjectCache;
 use Wikimedia\Assert\Assert;
-use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
 use Wikimedia\Rdbms\LoadBalancer;
 
@@ -275,9 +274,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
                        $this->getCacheKey( $blobAddress ),
                        $this->getCacheTTL(),
                        function ( $unused, &$ttl, &$setOpts ) use ( $blobAddress, $queryFlags ) {
-                               list( $index ) = DBAccessObjectUtils::getDBOptions( $queryFlags );
-                               $setOpts += Database::getCacheSetOptions( $this->getDBConnection( $index ) );
-
+                               // Ignore $setOpts; blobs are immutable and negatives are not cached
                                return $this->fetchBlob( $blobAddress, $queryFlags );
                        },
                        [ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => IExpiringStore::TTL_PROC_LONG ]
@@ -417,7 +414,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore {
                                        $this->getCacheKey( $cacheKey ),
                                        $this->getCacheTTL(),
                                        function () use ( $url, $flags ) {
-                                               // No negative caching per BlobStore::getBlob()
+                                               // Ignore $setOpts; blobs are immutable and negatives are not cached
                                                $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->wikiId ] );
 
                                                return $blob === false ? false : $this->decompressData( $blob, $flags );