Merge "Add MediaWiki-Timestamp header to ResourceLoader requests"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 15 Jul 2015 07:30:24 +0000 (07:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 15 Jul 2015 07:30:24 +0000 (07:30 +0000)
1  2 
includes/resourceloader/ResourceLoader.php

@@@ -224,8 -224,7 +224,8 @@@ class ResourceLoader implements LoggerA
                                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(
                        $exp = min( $maxage, $smaxage );
                        header( 'Expires: ' . wfTimestamp( TS_RFC2822, $exp + time() ) );
                }
+               // Send the current time expressed as fractional seconds since epoch,
+               // with microsecond precision. This helps distinguish hits from misses
+               // in edge caches.
+               header( 'MediaWiki-Timestamp: ' . microtime( true ) );
        }
  
        /**