WordPress at Your Fingertips
function is not described

WC_Cache_Helper::delete_version_transients() public WC 2.3.10

Deprecated from version 3.6.0 Adjusted transient usage to include versions within the transient values, making this cleanup obsolete.. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

When the transient version increases, this is used to remove all past transients to avoid filling the DB.

Note; this only works on transients appended with the transient version, and when object caching is not being used.

{} It's a method of the class: WC_Cache_Helper{}

Return

null. Nothing.

Usage

$result = WC_Cache_Helper::delete_version_transients( $version );
$version(string)
Version of the transient to remove.
Default: ''

Changelog

Since 2.3.10 Introduced.
Deprecated Since 3.6.0 Adjusted transient usage to include versions within the transient values, making this cleanup obsolete.

Code of WC_Cache_Helper::delete_version_transients() WC 5.9.0

public static function delete_version_transients( $version = '' ) {
	if ( ! wp_using_ext_object_cache() && ! empty( $version ) ) {
		global $wpdb;

		$limit = apply_filters( 'woocommerce_delete_version_transients_limit', 1000 );

		if ( ! $limit ) {
			return;
		}

		$affected = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s LIMIT %d;", '\_transient\_%' . $version, $limit ) ); // WPCS: cache ok, db call ok.

		// If affected rows is equal to limit, there are more rows to delete. Delete in 30 secs.
		if ( $affected === $limit ) {
			wp_schedule_single_event( time() + 30, 'delete_version_transients', array( $version ) );
		}
	}
}