objectcache: Support key versioning in WANObjectCache
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 12 May 2016 04:07:23 +0000 (21:07 -0700)
committerKrinkle <krinklemail@gmail.com>
Wed, 25 May 2016 18:03:21 +0000 (18:03 +0000)
commit0a38dbc809c82af925fa1df12f1d13d53a2dbde8
treefcae9d4f2df88f22d3529327562e3dc55cab9145
parentaa6546f762abfb2962fa7ba874e6ec7c297ec6db
objectcache: Support key versioning in WANObjectCache

* getWithSetCallback() takes a 'version' parameter.
* If the value at a key has a different version, then
  getWithSetCallback() will automatically use a separate
  key. Which value "wins" the main key does not matter.
* Purges are handled by using the main key as a sort of
  check key (with no hold-off). Note that this key is always
  purged on delete().
* Changed stash keys to track the same info as other keys
  both for consistency and because this change needs the
  generation timestamp. Renamed the stash prefix to avoid
  corrupt results with Het Deploy.
* This is useful for things like the User class that use
  versioning and have cross-wiki key access and purges.
  Currently, bumps to version must be deployed to all wikis
  at once, which this aims to avoid.

Change-Id: I26ae62f116e32b48bcf06bc13f8b9e79ae976745
includes/libs/objectcache/WANObjectCache.php
tests/phpunit/includes/libs/objectcache/WANObjectCacheTest.php