From 37532fa0dd140599b17353df6bf0c60719fa8ecc Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Wed, 26 Mar 2025 17:55:11 +0100
Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20cache=20flushin?=
=?UTF-8?q?g=20to=20clear=20entire=20groups?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
modules/ppcp-api-client/src/ApiModule.php | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/modules/ppcp-api-client/src/ApiModule.php b/modules/ppcp-api-client/src/ApiModule.php
index 12cdd12a6..be55b951e 100644
--- a/modules/ppcp-api-client/src/ApiModule.php
+++ b/modules/ppcp-api-client/src/ApiModule.php
@@ -113,23 +113,16 @@ class ApiModule implements ServiceModule, ExtendingModule, ExecutableModule {
'woocommerce_paypal_payments_flush_api_cache',
static function () use ( $c ) {
$caches = array(
- 'api.paypal-bearer-cache' => array(
- PayPalBearer::CACHE_KEY,
- ),
- 'api.client-credentials-cache' => array(
- SdkClientToken::CACHE_KEY,
- ),
+ 'api.paypal-bearer-cache',
+ 'api.client-credentials-cache',
+ 'settings.service.signup-link-cache',
);
- foreach ( $caches as $cache_id => $keys ) {
+ foreach ( $caches as $cache_id ) {
$cache = $c->get( $cache_id );
assert( $cache instanceof Cache );
- foreach ( $keys as $key ) {
- if ( $cache->has( $key ) ) {
- $cache->delete( $key );
- }
- }
+ $cache->flush();
}
}
);