objectcache: make RedisBagOStuff pass all tests
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 31 May 2018 20:41:48 +0000 (13:41 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 1 Jun 2018 03:43:10 +0000 (20:43 -0700)
commit13f7232bf4011668afdca27fa60893f4d0be2d31
tree4f5a782163d1917dbb3a8fad057057cc0cdaf395
parentaabe0ee110ba52382d6fe61908231a8a0be981d1
objectcache: make RedisBagOStuff pass all tests

* Provide a default lock-based BagOStuff::cas implementation
* Make RedisBagOStuff::merge() use mergeViaCas()
* Use the raw unserialized string as the redis CAS token to
  avoid any bad interaction with __wakeup() methods changing
  field values every time
* Make RedisBagOStuff::incr() return false when there is no
  such key, not null
* Rewrite merge() test to make the order of write/cas phase
  of the parent and child merge() calls well defined instead
  of arbitrary usleep() calls
* Avoid cache key reuse in test runs

Change-Id: I388ec173cf3858bb2fc7a8c8a00cda68703074ce
includes/libs/objectcache/BagOStuff.php
includes/libs/objectcache/RedisBagOStuff.php
tests/phpunit/includes/libs/objectcache/BagOStuffTest.php