Skip to content

Conversation

@rubas
Copy link

@rubas rubas commented Nov 5, 2017

Having filter hooks allows for a cleaner extension.

Copy link
Contributor

@danielbachhuber danielbachhuber left a 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.

*/
function pantheon_wp_clear_edge_keys( $keys ) {
$keys = array_unique( $keys );
$keys = \Pantheon_Advanced_Page_Cache\Emitter::filter_huge_surrogate_keys_list( $keys );
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Author

@rubas rubas Nov 22, 2017

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.

Copy link
Contributor

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 );
Copy link
Contributor

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do.

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 );
Copy link
Contributor

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do.

@danielbachhuber danielbachhuber added this to the 0.2.2 milestone Nov 22, 2017
@danielbachhuber danielbachhuber merged commit c7e1a1a into pantheon-systems:master Nov 22, 2017
@danielbachhuber danielbachhuber changed the title Filter hooks for surrogate key for purging Add more specific filters for modifying surrogate keys in different contexts Nov 27, 2017
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.

2 participants