From: Timo Tijhof Date: Tue, 7 Jul 2015 16:40:00 +0000 (+0100) Subject: resourceloader: Set a TTL for minification cache entries X-Git-Tag: 1.31.0-rc.0~10864^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=bdb4a243eabbbb7d0a29e99fd8ef341d37c8d9e7;p=lhc%2Fweb%2Fwiklou.git resourceloader: Set a TTL for minification cache entries Follows-up 458e7cabbbafd. HHVM's APC cache doesn't have any limitation or eviction logic. Thus entries without a TTL will linger indefinitely. At time of writing over 99% of APC entries were from "resourceloader:filter" because there are far more unpopular resources than popular ones. A fixed TTL is suboptimal as it will also cause popular resources (e.g. startup module, or jquery) to be re-minified every day. Beware this isn't one single minification. It's one minification, for every JS/CSS resource, on every app server, for many different lang/skin/config variations. Bug: T104769 Change-Id: Ib62c320da0eeede68aad3f2294006ec7dcf1df55 --- diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 5d0ed3c51b..e6cb5ebd46 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -224,7 +224,8 @@ class ResourceLoader implements LoggerAwareInterface { if ( $options['cacheReport'] ) { $result .= "\n/* cache key: $key */"; } - $cache->set( $key, $result ); + // 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(