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.
Метод класса: PaymentsProviders{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$PaymentsProviders = new PaymentsProviders(); $PaymentsProviders->clear_cache(): void;
Список изменений
| С версии 11.1.0 | Введена. |
Код PaymentsProviders::clear_cache() PaymentsProviders::clear cache WC 11.3.0
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 );
// Suggestion details are embedded in the gateway details, so clear their cache too.
$this->extension_suggestions->clear_cache();
}