Warning: This method has been deprecated. Adjusted transient usage to include versions within the transient values, making this cleanup obsolete instead.
WC_Cache_Helper::delete_version_transients( string $version = '' )
When the transient version increases, this is used to remove all past transients to avoid filling the DB.
Description Description
Note; this only works on transients appended with the transient version, and when object caching is not being used.
Parameters Parameters
- $version
-
(Optional) Version of the transient to remove.
Default value: ''
Source Source
File: includes/class-wc-cache-helper.php
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 ) ); } } }
Changelog Changelog
Version | Description |
---|---|
3.6.0 | Adjusted transient usage to include versions within the transient values, making this cleanup obsolete. |
2.3.10 | Introduced. |