ResourceLoader::filter: use APC when running under HHVM

On HHVM, (a) the cost of a ResourceLoader::filter cache miss is smaller, and
(b) APC is faster and more resilient than PHP's. These two things tilt the
scales in favor of using APC rather than Memcached.

Change-Id: I30b490e5bc815849d4b0bb06f2dbbb68825ed225
This commit is contained in:
Ori Livneh 2015-05-12 20:45:01 -07:00
parent 2b8a3f0238
commit 458e7cabbb

View file

@ -195,9 +195,8 @@ class ResourceLoader {
if ( !$options['cache'] ) {
$result = $this->applyFilter( $filter, $data );
} else {
// Use CACHE_ANYTHING since filtering is very slow compared to DB queries
$key = wfMemcKey( 'resourceloader', 'filter', $filter, self::$filterCacheVersion, md5( $data ) );
$cache = wfGetCache( CACHE_ANYTHING );
$cache = wfGetCache( wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING );
$cacheEntry = $cache->get( $key );
if ( is_string( $cacheEntry ) ) {
wfIncrStats( "rl-$filter-cache-hits" );