From 972233c945317217928cfa286f9c0f1aab913f0c Mon Sep 17 00:00:00 2001 From: Keanan Koppenhaver Date: Sun, 3 Nov 2019 16:52:16 -0600 Subject: [PATCH 1/2] First pass at adding cache clearing on post update --- php/class-plugin.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/php/class-plugin.php b/php/class-plugin.php index 00b35d0..c845596 100644 --- a/php/class-plugin.php +++ b/php/class-plugin.php @@ -139,6 +139,15 @@ public function handle_existing_post( $post, $request ) { $standards ); + if( class_exists( 'Redis_Page_Cache' ) ) { + $cache = new Redis_Page_Cache(); + $plugin_version = $request->get_param( 'version' ); + + $url_to_clear = get_rest_url( null, sprintf( 'tide/v1/audit/wporg/%s/%s/%s', $project_type, $slug, $plugin_version ) ); + + $cache::clear_cache_by_url( $url_to_clear ); + } + // Consider this request handled! static::$handled = true; From 39adf1788b5ad8215762b2f631f6674deca7483b Mon Sep 17 00:00:00 2001 From: Keanan Koppenhaver Date: Sun, 3 Nov 2019 22:30:33 -0600 Subject: [PATCH 2/2] phpcs --- php/class-plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php/class-plugin.php b/php/class-plugin.php index c845596..95a24d1 100644 --- a/php/class-plugin.php +++ b/php/class-plugin.php @@ -139,7 +139,7 @@ public function handle_existing_post( $post, $request ) { $standards ); - if( class_exists( 'Redis_Page_Cache' ) ) { + if ( class_exists( 'Redis_Page_Cache' ) ) { $cache = new Redis_Page_Cache(); $plugin_version = $request->get_param( 'version' );