objectcache: Make MemcachedBagOStuff::makeKeyInternal always have a key class
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 21 Nov 2017 00:04:38 +0000 (16:04 -0800)
committerKrinkle <krinklemail@gmail.com>
Tue, 21 Nov 2017 02:45:01 +0000 (02:45 +0000)
Even if a key is too long and shortened, it should still have some key class.

Change-Id: I006b6b03ad1302e9e49362bbd051332bc6105837

includes/libs/objectcache/MemcachedBagOStuff.php
tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php

index 0188991..f7bf86b 100644 (file)
@@ -137,7 +137,7 @@ class MemcachedBagOStuff extends BagOStuff {
                );
 
                if ( $charsLeft < 0 ) {
-                       return $keyspace . ':##' . md5( implode( ':', $args ) );
+                       return $keyspace . ':BagOStuff-long-key:##' . md5( implode( ':', $args ) );
                }
 
                return $keyspace . ':' . implode( ':', $args );
index 7814b83..9cb2f94 100644 (file)
@@ -42,7 +42,7 @@ class MemcachedBagOStuffTest extends MediaWikiTestCase {
                );
 
                $this->assertEquals(
-                       'test:##dc89dcb43b28614da27660240af478b5',
+                       'test:BagOStuff-long-key:##dc89dcb43b28614da27660240af478b5',
                        $this->cache->makeKey( '𝕖𝕧𝕖𝕟', '𝕚𝕗', '𝕨𝕖', '𝕄𝔻𝟝', '𝕖𝕒𝕔𝕙',
                                '𝕒𝕣𝕘𝕦𝕞𝕖𝕟𝕥', '𝕥𝕙𝕚𝕤', '𝕜𝕖𝕪', '𝕨𝕠𝕦𝕝𝕕', '𝕤𝕥𝕚𝕝𝕝', '𝕓𝕖', '𝕥𝕠𝕠', '𝕝𝕠𝕟𝕘' )
                );