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

Poc/early cache return #5663

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Draft

Conversation

kt-12
Copy link
Member

@kt-12 kt-12 commented Nov 13, 2023

This PR is a POC for early caching for WP_Query.

We have 38 filters in get_posts. Even though we have caching implemented, caching doesn't actively skip all the filters.

In most cases, these filters are only used for static modification of queries, so handling caching early using only the filter signature would let us skip all the filters for cached content.

Know issues which prevent caching from being moved on top for all the queries ->

  • Filters can be used for dynamic modification of queries like current date or current user based changes to the query or any other form of dynamic changes that cannot be recorded by filter signature alone.
  • Filters can also be used as actions, preventing us from skipping them.

I have also done a performance test for this PoC, keeping cache_early active by default for all the queries. Even though the code could return the cache early, there wasn't any performance benefit as themes had 0 to no modification done to the query. However, this option could benefit a site using query filters for static changes alone and then use caching.

Trac ticket:


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

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