Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid redundant cache misses #482

Open
joemcgill opened this issue Jan 3, 2025 · 0 comments
Open

Avoid redundant cache misses #482

joemcgill opened this issue Jan 3, 2025 · 0 comments

Comments

@joemcgill
Copy link

Generally, when get_option() is called and the option does not exist, WordPress will store the option in the 'notoptions' cache to avoid unnecessary DB requests on subsequent calls to the option. In https://core.trac.wordpress.org/changeset/56595 (shipped in WP 6.4), a change was made to check object cache (when present) before checking the 'notoptions' cache to avoid an unnecessary check of 'notoptions' when the option does exist, but this has been reported to cause an increase in requests to object caches when the option does not exist in https://core.trac.wordpress.org/ticket/62692 if the object cache implementation does not ensure that cache misses avoid redundant calls to the same non-existent option.

This comment, on the second ticket includes a list of implementations affected, including this one.

Even when this is fixed and shipped (hopefully in WP 6.8) people running versions of WP from 6.4–6.7 will still be affected by this bug unless it's handled at the object cache layer.

Reproduction steps

Call get_option( 'notexist' ) in a loop. Prior to 6.4, this would generate 2 total cache gets; after 6.4, it generates an infinite number, as each iteration of the cycle triggers a cache get which misses.

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

No branches or pull requests

1 participant