It took me lots of time to debug a CI failure in
I9b3bc36b552901bc6ca7609ee51e80be2979a9c4. I was deceived by
$cache->set returning true, which according to the docs means that the
store was successful. But instead, this function just returns true, even
in case of failure. Make it return the result of apcu_store, which is
already in the format true = success, false = failure.
Change-Id: I2619845c12460e1acb5af696d2c11a5a4dee1bd3
Also make sure they always use PHP serialization to avoid CAS token problems
and bugs in the custom pecl extension serializers.
Change-Id: I43cef97ca4ac0f0cc21b65ba73d1887ed92e157f
This avoids an extra cache query and also avoids I/O if another thread
already saved the value in the meantime, bloating the GET response.
Bug: T203786
Change-Id: I05539873f55d3254e2b9ecad0df158db1e6a1a1a
Also, reorder some method definitions to match the base class.
This makes it easier to compare the two. In addition, refactor
the doWrite() method to make the calls clearer.
Change-Id: I795b395b9c54645f62962461a28067ae38b291ed
Also reorder methods to match the base class so it is easier
to compare the classes and see which methods should be defined.
Change-Id: I2b8c2cd63822ce49efd9b4b7e44bde92032b5a98
This way, the $attempts parameter to merge() is respected and locks
are not held while possibly slow callbacks might run.
Also renamed confusingly named serialization functions in HashBagOStuff.
Change-Id: Id031d82e0a7c941936f04d2cdf590a6296777cf8
Do not hold WinCache locks during merge() callbacks, as that
could be seconds of being blocked (and some callers do not
expect indefinite blocking). Make merge() use the CAS method
which only uses wincache_lock() after callback runs in very
tight getWithToken()/set() cycle.
Make incr() use wincache_lock() since it also is very tight
doGet()/set() cycle with negligable work in between.
Change-Id: I0dde6f62c7e3d4a802470c181570ad4353d0e6ea
Callers should really use atomic TTL-preserving implementations
so that calling code works correctly. The old default base class
code did not do either.
Change-Id: Icf66db05e48b86c8d481dc08dc9041bd1fa6dbe9
Also:
* Make the BagOStuff tests actually pass for memcached and sql
* Add more unit tests for BagOStuff
* Make SqlBagOStuff::add() more atomic
Change-Id: Ic1eec0990a66b595b57c646498c3bd229442230c
This should be the "last revision seen" timestamp, which is
different than the "first revision not seen" timestamp in the DB.
Also make sure that SpecialWatchlist accounts for the stash values.
Relatedly, better document the callback usage in BagOStuff::merge().
Change-Id: I98b03a5cd40fec5b4a2633d499ff77079d264e3c
This was inspired by Idbbdb31. Originally, I did a regex search for
code that did string concatenations like `$str = $str . …` and replaced
them all with the .= operator. A duplicate patch was uploaded by another
author. I rebeased this patch on top of the other, which leaves all
the manual optimizations I did.
Change-Id: Iaeb73d9c63302c9409bd1051b91e0d2bd77788a7
This was only there as part of EventRelayer use by WAN cache, which
has since been removed. No other usage really makes sense.
Change-Id: I201425bb88739dd8febbfbc3d24a15e6d3d88d9c