Page MenuHomePhabricator

DifferenceEngine cache ignores hits for empty diffs
Closed, ResolvedPublic

Description

The relevant code is in DifferenceEngine.php, lines 1035–1043:

// Try cache
if ( !$this->mRefreshCache ) {
    $difftext = $cache->get( $key );
    if ( $difftext ) {
        wfIncrStats( 'diff_cache.hit' );
        $difftext = $this->localiseDiff( $difftext );
        $difftext .= "\n<!-- diff cache key $key -->\n";

        return $difftext;
    }
} // don't try to load but save the result

The problem is that if the diff is the empty string, if ( $difftext ) will fail and so the cache won't be used.

Event Timeline

Anomie created this task.Feb 19 2019, 8:54 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 19 2019, 8:54 PM

Change 491582 had a related patch set uploaded (by Anomie; owner: Anomie):
[mediawiki/core@master] DifferenceEngine: Allow cache hits for empty diffs

https://gerrit.wikimedia.org/r/491582

Change 491582 merged by jenkins-bot:
[mediawiki/core@master] DifferenceEngine: Allow cache hits for empty diffs

https://gerrit.wikimedia.org/r/491582

Anomie closed this task as Resolved.Feb 20 2019, 8:03 PM
Aklapper removed a subscriber: Anomie.Oct 16 2020, 5:38 PM