Consolidate common Preprocessor caching code
authorOri Livneh <ori@wikimedia.org>
Thu, 8 Oct 2015 20:54:15 +0000 (13:54 -0700)
committerTim Starling <tstarling@wikimedia.org>
Sun, 25 Oct 2015 23:06:48 +0000 (23:06 +0000)
commit1559be9f7aefb57dafbfd5dd5a363ff225b05fa1
tree5c595f81b780cc2979dcd77f02540390ad2899c0
parent8b8f6d15e097b07ab92c95296ecb9ec212696896
Consolidate common Preprocessor caching code

* Consolidate nearly-identical caching code in Preprocessor_DOM and
  Preprocessor_Hash by making Preprocessor an abstract class rather than an
  interface and by implementing Preprocessor::cacheSetTree() and
  Preprocessor::cacheGetTree().
* Cache trees for wikitext blobs that have length equal or greater to
  PreprocessorCacheThreshold. Previously they needed to be greater than
  PreprocessorCacheThreshold, so this changes the requirement by one character.
  I did it because it seems more natural.
* Modernize the code to use singleton service objects rather than globals.

We spend a lot of time in the Preprocessor, so it would be nice for this code
to be well-factored and clear.

Change-Id: Ib71c29f14a28445a505e12c774a24ad964330b95
includes/parser/Preprocessor.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php