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.