Automattic\WooCommerce\Internal\Admin\Settings
PaymentsProviders::clear_cache
Clear cached payment gateway data, including the provider lists the Payments service derives from it.
Call after changing gateway registration, settings, or account state during a request. Also useful for testing purposes.
Method of the class: PaymentsProviders{}
No Hooks.
Returns
void. Nothing (null).
Usage
$PaymentsProviders = new PaymentsProviders(); $PaymentsProviders->clear_cache(): void;
Changelog
| Since 11.1.0 | Introduced. |
PaymentsProviders::clear_cache() PaymentsProviders::clear cache code WC 11.1.1
public function clear_cache(): void {
$this->payment_gateways_cache = array();
$this->payment_gateways_for_display_cache = array();
wp_cache_delete( self::GATEWAY_DETAILS_REQUEST_CACHE_KEY, self::GATEWAY_DETAILS_REQUEST_CACHE_GROUP );
// The Payments service owns and also clears this cache; deleting it here keeps direct callers of this service from reading stale provider lists.
wp_cache_delete( self::PROVIDER_LISTS_REQUEST_CACHE_KEY, self::PROVIDER_LISTS_REQUEST_CACHE_GROUP );
}