resourceloader: Set a TTL for minification cache entries

Follows-up 458e7cabbb. 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
This commit is contained in:
Timo Tijhof 2015-07-07 17:40:00 +01:00 committed by Ori.livneh
parent 1224a70009
commit bdb4a243ea

View file

@ -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(