Cache first-letter data in APC, if available
authorOri Livneh <ori@wikimedia.org>
Mon, 11 Apr 2016 23:41:57 +0000 (16:41 -0700)
committerOri Livneh <ori@wikimedia.org>
Mon, 11 Apr 2016 23:52:57 +0000 (16:52 -0700)
I noticed that `frwiki:first-letters:fr:fr:4.8.1.1` was at the very top of keys
sorted by bandwidth (that is, reqs/sec * size) on one of the memcache servers
on WMF prod.

The data takes ~60 - 80ms to compute, in case of a cache miss. That's not
enough to justify using a tiered cache abstraction here, IMO.

Change-Id: If81ce8f86f2c378565f1f6a0dd2c04dee825c4e9

includes/collation/IcuCollation.php

index 0aa1406..942036b 100644 (file)
@@ -240,8 +240,8 @@ class IcuCollation extends Collation {
                        return $this->firstLetterData;
                }
 
-               $cache = wfGetCache( CACHE_ANYTHING );
-               $cacheKey = wfMemcKey(
+               $cache = ObjectCache::getLocalServerInstance( CACHE_ANYTHING );
+               $cacheKey = $cache->makeKey(
                        'first-letters',
                        $this->locale,
                        $this->digitTransformLanguage->getCode(),