-
Notifications
You must be signed in to change notification settings - Fork 13
Add more specific filters for modifying surrogate keys in different contexts #109
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
Conversation
danielbachhuber
left a comment
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.
👍 Good idea generally. Left a few comments to address.
pantheon-advanced-page-cache.php
Outdated
| */ | ||
| function pantheon_wp_clear_edge_keys( $keys ) { | ||
| $keys = array_unique( $keys ); | ||
| $keys = \Pantheon_Advanced_Page_Cache\Emitter::filter_huge_surrogate_keys_list( $keys ); |
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.
Why are you calling filter_huge_surrogate_keys_list() in this context?
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'm not sure, if Pantheon purges the keys with Header or JSON post body.
But after double checking the Fastly Documentation, it would be better to check for max 256 keys instead of const HEADER_MAX_LENGTH = 32512 assuming they purge via JSON post body.
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.
@rubas Oh, we can remove. Pantheon has middleware to safely handle large lists of keys.
Do you want to finish up this PR or shall I?
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.
Do you want to finish up this PR or shall I?
Nevermind, just saw your other comments. We can land this today, and then I'll tag a release on Monday.
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.
Pantheon has middleware to safely handle large lists of keys.
👍
Do you want to finish up this PR or shall I?
Happy to hand it over. Otherwise I'll have a look at it this weekend.
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.
Ok, doing now.
| public static function action_clean_term_cache( $term_ids ) { | ||
| $keys = array(); | ||
| $term_ids = is_array( $term_ids ) ? $term_ids : array( $term_id ); | ||
| $term_ids = is_array( $term_ids ) ? $term_ids : array( $term_ids ); |
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.
Can you remove this from the PR please?
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'll do.
inc/class-purger.php
Outdated
| return; | ||
| } | ||
| pantheon_wp_clear_edge_keys( array( 'post-' . $post_id, 'rest-post-' . $post_id, 'post-huge', 'rest-post-huge' ) ); | ||
| $keys = apply_filters( 'pantheon_purge_clean_post_cache', array( 'post-' . $post_id, 'rest-post-' . $post_id, 'post-huge', 'rest-post-huge' ), $post_id ); |
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.
For each filter, can you make sure you're indenting with tabs, not spaces, and add the appropriate doc block?
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'll do.
Having filter hooks allows for a cleaner extension.