Repository navigation
Object Cache: flush stale values after the backend was unreachable - #1069
Open
timotei-litespeed wants to merge 1 commit into
Open
timotei-litespeed wants to merge 1 commit into
timotei-litespeed wants to merge 1 commit into
Conversation
While Redis or Memcached cannot be reached (failed connection, timeout, a Redis error, or a Memcached write that fails), writes and deletes are skipped but the database still changes. Most WordPress groups never expire, so once the backend answers again it keeps serving the old values, e.g. stale options or session tokens that log users out. A skipped write or delete now leaves a marker file in wp-content/litespeed/ (wp-content/ before that folder exists). The next request that connects removes it and flushes the backend once, the same flush as Purge All (flushDb() on Redis, flush() on Memcached). Cache keys are unchanged. On multisite the marker is network-wide: a write skipped on any subsite can leave stale global groups (users, site options), so the whole network starts over together. If the flush fails, the request stops using the backend and the marker is set again for the next request.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While Redis or Memcached cannot be reached (failed connection, timeout, a Redis error, or a Memcached write that fails), writes and deletes are skipped but the database still changes. Most WordPress groups never expire, so once the backend answers again it keeps serving the old values, e.g. stale options or session tokens that log users out.
A skipped write or delete now leaves a marker file in wp-content/litespeed/ (wp-content/ before that folder exists). The next request that connects removes it and flushes the backend once, the same flush as Purge All (flushDb() on Redis, flush() on Memcached). Cache keys are unchanged.
On multisite the marker is network-wide: a write skipped on any subsite can leave stale global groups (users, site options), so the whole network starts over together.
If the flush fails, the request stops using the backend and the marker is set again for the next request.