From 627328df9c58147594f8a0a2739c0904047970cf Mon Sep 17 00:00:00 2001 From: Emili Castells Guasch Date: Fri, 9 Aug 2024 12:33:05 +0200 Subject: [PATCH] Remove cache references --- modules/ppcp-api-client/services.php | 3 +-- modules/ppcp-api-client/src/ApiModule.php | 12 ------------ .../src/Authentication/UserIdToken.php | 15 +-------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/modules/ppcp-api-client/services.php b/modules/ppcp-api-client/services.php index 7f62da5f6..70720e0b4 100644 --- a/modules/ppcp-api-client/services.php +++ b/modules/ppcp-api-client/services.php @@ -1669,8 +1669,7 @@ return array( return new UserIdToken( $container->get( 'api.host' ), $container->get( 'woocommerce.logger.woocommerce' ), - $container->get( 'api.client-credentials' ), - $container->get( 'api.client-credentials-cache' ) + $container->get( 'api.client-credentials' ) ); }, 'api.sdk-client-token' => static function( ContainerInterface $container ): SdkClientToken { diff --git a/modules/ppcp-api-client/src/ApiModule.php b/modules/ppcp-api-client/src/ApiModule.php index 2d63bd80f..8b2f43911 100644 --- a/modules/ppcp-api-client/src/ApiModule.php +++ b/modules/ppcp-api-client/src/ApiModule.php @@ -96,18 +96,6 @@ class ApiModule implements ModuleInterface { 10, 2 ); - - add_action( - 'wp_logout', - function( int $user_id ) use ( $c ) { - $client_credentials_cache = $c->get( 'api.client-credentials-cache' ); - assert( $client_credentials_cache instanceof Cache ); - - if ( $client_credentials_cache->has( UserIdToken::CACHE_KEY . '-' . (string) $user_id ) ) { - $client_credentials_cache->delete( UserIdToken::CACHE_KEY . '-' . (string) $user_id ); - } - } - ); } /** diff --git a/modules/ppcp-api-client/src/Authentication/UserIdToken.php b/modules/ppcp-api-client/src/Authentication/UserIdToken.php index 2552483ee..dde47c223 100644 --- a/modules/ppcp-api-client/src/Authentication/UserIdToken.php +++ b/modules/ppcp-api-client/src/Authentication/UserIdToken.php @@ -11,7 +11,6 @@ use Psr\Log\LoggerInterface; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\RequestTrait; use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException; use WooCommerce\PayPalCommerce\ApiClient\Exception\RuntimeException; -use WooCommerce\PayPalCommerce\ApiClient\Helper\Cache; use WP_Error; /** @@ -21,8 +20,6 @@ class UserIdToken { use RequestTrait; - const CACHE_KEY = 'user-id-token-key'; - /** * The host. * @@ -44,31 +41,21 @@ class UserIdToken { */ private $client_credentials; - /** - * The cache. - * - * @var Cache - */ - private $cache; - /** * UserIdToken constructor. * * @param string $host The host. * @param LoggerInterface $logger The logger. * @param ClientCredentials $client_credentials The client credentials. - * @param Cache $cache The cache. */ public function __construct( string $host, LoggerInterface $logger, - ClientCredentials $client_credentials, - Cache $cache + ClientCredentials $client_credentials ) { $this->host = $host; $this->logger = $logger; $this->client_credentials = $client_credentials; - $this->cache = $cache; } /**