- $key = wfGlobalCacheKey(
- 'resourceloader',
- 'filter',
- $filter,
- self::$filterCacheVersion, md5( $data )
- );
- $cache = wfGetCache( wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING );
- $cacheEntry = $cache->get( $key );
- if ( is_string( $cacheEntry ) ) {
- $stats->increment( "resourceloader_cache.$filter.hit" );
- return $cacheEntry;
- }
- $result = '';
- try {
- $statStart = microtime( true );
- $result = self::applyFilter( $filter, $data, $this->config );
- $statTiming = microtime( true ) - $statStart;
- $stats->increment( "resourceloader_cache.$filter.miss" );
- $stats->timing( "resourceloader_cache.$filter.timing", 1000 * $statTiming );
- if ( $options['cacheReport'] ) {
- $result .= "\n/* cache key: $key */";
- }
- // Set a TTL since HHVM's APC doesn't have any limitation or eviction logic.
- $cache->set( $key, $result, 24 * 3600 );
- } catch ( Exception $e ) {
- MWExceptionHandler::logException( $e );
- $this->logger->warning( 'Minification failed: {exception}', array(
- 'exception' => $e
- ) );
- $this->errors[] = self::formatExceptionNoComment( $e );
- }