WC_Rate_Limiter::cleanup()public staticWC 1.0

Cleanup expired rate limits from the database and clear caches.

Method of the class: WC_Rate_Limiter{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Rate_Limiter::cleanup();

WC_Rate_Limiter::cleanup() code WC 8.7.0

public static function cleanup() {
	global $wpdb;

	$wpdb->query(
		$wpdb->prepare(
			"DELETE FROM {$wpdb->prefix}wc_rate_limits WHERE rate_limit_expiry < %d",
			time()
		)
	);

	if ( class_exists( 'WC_Cache_Helper' ) ) {
		WC_Cache_Helper::invalidate_cache_group( self::CACHE_GROUP );
	}
}