Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
joemcgill
left a comment
There was a problem hiding this comment.
Oh, this is interesting. I'm going to think on it a bit.
My knee-jerk reaction is that making such a big change the the main wp_cache_ functions, is likely not the right approach, but there is something kind of clever about trying to make it easier to optionally back caches in non-persistent environments with transients without a lot of repeated code.
I wonder if it would be easier to handle from the opposite perspective, given that transients already get saved to external object cache when available? I think the main things that are missing for transients are the ability to set a cache group besides 'transient' which is where they all get stored now, and a way to ensure transients that are stored in the DB options table get flushed whenever the cache group they belong to gets flushed.
The reason I was inclined to the changes here is :
I was analysing both the functions The problem I felt with making changes to transient side functions is that;
Lastly, I felt it was more of a caching problem than a transient problem (even though they mean the same), so I added my code to |
|
Thanks for explaining your thinking in a bit more detail. Still, I don't think caching block theme files warrants a major modification of the Cache API to make use of Transients as a first class way to provide persistence in non-persistent environments. I think doing so confuses the responsibilities of these two APIs somewhat. For context, here's how I would describe the purpose of both APIs:
Realistically, for sites that want cached data to persist, the solution is to install a persistent object cache. Backing these caches with transients is usually redundant and unnecessary. For data that should persist, regardless of an external object cache, the data should be stored in a transient, which will get offloaded to an external object cache if available. For block template files, if we want to ensure persistence, we could simply prioritize the use of transients. However, since we want to provide a way for environments with persistent caches to flush these caches using cache groups, we will need to manually check for whether |
Trac ticket: https://core.trac.wordpress.org/ticket/59600
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.