mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
d90e2d1066
To use WANObjectCache correctly in a multi-DC-safe way, we need to use getWithSetCallback() to read data, and call delete() when it changes. NotifUser's caching of notification counts and timestamps relied heavily on set() calls, and so wasn't multi-DC-safe. Changes in this commit: * Rather than caching counts/timestamps in separate cache keys, and using separate cache keys for each section (alert/message/all), put all this data in an array and store that in a single cache key. This reduces the number of cache keys per user per wiki from 6 to 1. * Similarly, use a single global cache key per user. The global check key for the last updated timestamp is retained, so we now have 2 global cache keys per user (down from 7) * Remove preloading using getMulti(), no longer needed * Move computation of counts and timestamps into separate compute functions (one for local, one for global), and wrap them with a getter that uses getWithSetCallback(). * Use TS_MW strings instead of MWTimestamp objects internally, to simplify comparisons and max() operations. * Make existing getters wrap around this new getter. They now ignore their $cached and $dbSource parameters, and we should deprecate/change these function signatures. * In resetNotificationCounts(), just delete the cache keys. In global mode, also recompute the notification counts and put them in the echo_unread_wikis table. We could also set() the data into the cache at this point, but don't, because you're not supposed to mix set() and getWithSetCallback() calls and I don't want to find out what happens if you do. Bug: T164860 Change-Id: I4f86aab11d50d20280a33e0504ba8ad0c6c01842 |
||
---|---|---|
.. | ||
phpunit | ||
qunit | ||
rspec | ||
selenium | ||
bootstrap.php | ||
echo.suite.xml | ||
NotificationsTest.php |