Request-local caching of revision text
authorOri Livneh <ori@wikimedia.org>
Wed, 23 Mar 2016 00:21:48 +0000 (17:21 -0700)
committerOri Livneh <ori@wikimedia.org>
Wed, 23 Mar 2016 05:28:31 +0000 (22:28 -0700)
commit388d4745aa7eb01bee4a5b27c312928967be4495
tree578feef1b00ccb43909815781c4c0f05f52a1e1c
parent4a3d9794a03b8776a9ac1d1328e46a81897a6404
Request-local caching of revision text

It's not uncommon for the revision text of a Scribunto module to be retrieved
half a dozen times or more in the course of a single request. Caching them in
APC is a non-starter, because there is no practical way to determine which keys
are hot, and storing everything in APC is not viable. Request-local caching
gives us much of the benefit with no negative consequences apart from a nominal
increase to memory usage.

Use a MapCacheLRU to hold cache items so we can limit the size of the cache to
10 items, to prevent uncontrolled memory growth for long-running scripts.

Change-Id: I77575d6d0ea2d06fc6c93f664c5407641aab88d9
includes/Revision.php