MessageCache: use APC for local caching, rather than files
authorOri Livneh <ori@wikimedia.org>
Sun, 9 Aug 2015 04:59:47 +0000 (21:59 -0700)
committerOri Livneh <ori@wikimedia.org>
Mon, 10 Aug 2015 19:39:11 +0000 (12:39 -0700)
commit3a252efa12253e77a07a75da25bcf558c5bcd209
treeb0807851e8d2a8878adafdb6e53fdf2f1034a45e
parentf6fd34a95ee94d33dc01a5be91e2f5032fac2165
MessageCache: use APC for local caching, rather than files

In addition to eliminating disk IO in a hot path, using APC spares us from
having to serialize and unserialize cache arrays. Since we're not serializing,
though, we don't have a string representation to hash, so use a random string
instead. (The code already treats the association of hash string to cache as
purely symbolic, so this is not problematic.)

Whereas the hash was previously stored as the first 32 bytes of each cache
file, we now store it as an array key instead (like VERSION and EXPIRY were
already). Because this changes the structure of cached data, we have to bump
MSG_CACHE_VERSION.

While we're here, make MessageCache::getLocalCache() and
MessageCache::saveToLocal() protected, make their signatures more
consistent with other methods in this class. While they were (implicitly)
public before, there are absolutely no external callers in Core or
extensions[0][1], so we can skip the standard deprecation process.

[0]: https://github.com/search?q=%40wikimedia+getlocalcache&type=Code&utf8=%E2%9C%93
[1]: https://github.com/search?utf8=%E2%9C%93&q=%40wikimedia+savetolocal&type=Code

Change-Id: I020617d2df2a8f0f243b85f3383dc7b16f15aaad
RELEASE-NOTES-1.26
includes/cache/MessageCache.php