mirrored from git://develop.git.wordpress.org/
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
Pattern Cache using Transient #6137
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c232c70
transient support
kt-12 9069099
cs fixes
kt-12 8565cb0
caching theme
kt-12 6bb8ab8
Apply suggestions from code review
kt-12 881df5d
remove group name from filter
kt-12 0e4868c
Add caching to template part and block template file
kt-12 cd34a68
Update version
kt-12 7eb787d
use static variable instead
kt-12 f08304c
fix cache key issue.
kt-12 0702339
theme broken issue fix and expiry time
kt-12 5542277
Merge branch 'trunk' into enhancement/patern-cache-transient
kt-12 bfe9ece
Revert back changes
kt-12 425e674
revert back to old state
kt-12 4d92ac0
disabled cached test
kt-12 2a170b9
bug fix
kt-12 fd586f3
scope fix
kt-12 d82bd36
test for transient cache
kt-12 458b851
transient check and filter check
kt-12 a255a9b
cache key update
kt-12 899b983
int for cache_expiration
kt-12 0a6ed79
update code to handle transient based caching
kt-12 5178a5f
cs fixes
kt-12 814eb17
Update tests/phpunit/tests/theme/wpThemeGetBlockPatterns.php
kt-12 5a536a8
Update tests/phpunit/tests/theme/wpThemeGetBlockPatterns.php
kt-12 e34a3d5
Update src/wp-includes/class-wp-theme.php
kt-12 25bbb35
Apply suggestions from code review
kt-12 6ffe308
Update src/wp-includes/class-wp-theme.php
kt-12 19f2952
Merge branch 'trunk' into enhancement/patern-cache-transient
kt-12 a53c35e
Merge branch 'enhancement/patern-cache-transient' of https://github.c…
kt-12 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a blocker, but I don't think we should disallow setting these to never expire. I think a better validation would be to not cast the return value above and throw a doing it wrong if the return value is not an
int
. That would keep someone returningfalse
thinking they were turning off caching from accidentally caching this indefinitely. Happy to go with this for now and consider as a follow-up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joemcgill That would work for me, though my follow up question would be how you would "sanitize" the
false
then? Simply use the originalself::$cache_expiration
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, we'd basically do the same thing we're already doing, but instead of
if ( $cache_expiration <= 0 ) { ...
we'd doif ( ! is_int( $cache_expiration ) { ...
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kt-12 had originally implemented it this way actually and I had suggested to be more "forgiving" and cast to integer instead of warning when not returning an integer. Your argument around
false
makes sense to me, but my concern was more about someone returning'30'
and that value failing, which really it doesn't have to fail since a string containing a number could be perfectly fine to let through (and cast to an integer).But I'm onboard with your suggestion, and even with my caveat, there's always a benefit to use strict typing anyway.