Problem/Motivation

Every cache set and delete on the chained fast backend invalidates the fast backend.

However, there are two kinds of cache set:

1. A cache set that updates an existing cache item in the bin
2. A cache set that adds a new row to the cache bin

For #2, we don't need to invalidate the fast backend, because it won't have an entry to invalidate either.

The tricky thing is determining the difference between #1 and #2 but I might have an idea.

Steps to reproduce

Proposed resolution

When setting items in chained fast, first attempt to get cache items from the persistent backend. If any item is found, then update the last write timestamp, otherwise leave it as is. Because we're trying to get those cache items at the exact moment we'd otherwise be writing them, any potential race condition is essentially moot - the two cache items could conflict anyway.

While this means additional cache gets from the persistent backend when calling ::set(), it should more than reduce those overall when items can continue to be fetched from the fast backend.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3588547

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review

Something like this.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.25 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

catch’s picture

Status: Needs work » Needs review
Issue tags: +Performance

Updated unit test coverage to cover both the empty and non-empty cases.

catch’s picture