Don't use complex datatypes as CAS tokens
authorMatthias Mullie <git@mullie.eu>
Tue, 14 Jan 2014 10:27:58 +0000 (11:27 +0100)
committerMatthias Mullie <git@mullie.eu>
Tue, 14 Jan 2014 15:45:32 +0000 (16:45 +0100)
commit2a4dfa169bd42eb7c68761155d44c450bcdc1423
treec751b4cd04baa78cdd03831e79019b127defb522
parent8bbf41ec84c8a72a640dd529048c90f038df2efb
Don't use complex datatypes as CAS tokens

For caches where CAS is not natively supported, we have a workaround, where the
CAS token is (based on) the stored value.

To confirm the data can be written to cache, the CAS token is compared against
"whatever is currently in cache", so we pull the cached data and rebuild the
value.

In the case of objects, we have now pulled & rebuilt (unserialized) 2 objects
that are actually the same object (for CAS purpose - it's the correct value to
overwrite), but in terms of ===, they're 2 different values.

This patch should make sure CAS tokens are always a serialized version of the
value we're saving (where no native CAS exists); these serialized versions can
reliably be compared.

Bug: 59941
Change-Id: I2760416c48f2ceb7a0e0c874dd70ec07b4dccdfc
includes/objectcache/DBABagOStuff.php
includes/objectcache/HashBagOStuff.php
includes/objectcache/RedisBagOStuff.php