Skip to content

Object Cache: flush stale values after the backend was unreachable - #1069

Open
timotei-litespeed wants to merge 1 commit into
litespeedtech:devfrom
timotei-litespeed:fix-oc-skipped-writes
Open

timotei-litespeed wants to merge 1 commit into
litespeedtech:devfrom
timotei-litespeed:fix-oc-skipped-writes

Conversation

@timotei-litespeed

Copy link
Copy Markdown
Contributor

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant