<?php
+/**
+ *
+ * @package MediaWiki
+ */
+/**
+ *
+ * @package MediaWiki
+ */
class ParserCache
{
function getKey( &$article, &$user ) {
function get( &$article, &$user ) {
global $wgMemc, $wgCacheEpoch;
- $fname = "ParserCache::get";
+ $fname = 'ParserCache::get';
wfProfileIn( $fname );
$hash = $user->getPageRenderingHash();
if ( $value ) {
wfDebug( "Found.\n" );
# Delete if article has changed since the cache was made
- $touched = $article->getTouched();
+ $canCache = $article->checkTouched();
$cacheTime = $value->getCacheTime();
- if ( $value->getCacheTime() <= $touched || $cacheTime < $wgCacheEpoch ) {
- wfDebug( "Key expired, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
+ $touched = $article->mTouched;
+ if ( !$canCache || $value->getCacheTime() <= $touched || $cacheTime < $wgCacheEpoch ) {
+ if ( !$canCache ) {
+ wfDebug( "Invalid cached redirect, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
+ } else {
+ wfDebug( "Key expired, touched $touched, epoch $wgCacheEpoch, cached $cacheTime\n" );
+ }
$wgMemc->delete( $key );
$value = false;
}
function save( $parserOutput, &$article, &$user ){
global $wgMemc;
+
$key = $this->getKey( $article, $user );
$now = wfTimestampNow();
$parserOutput->setCacheTime( $now );