WP_CLI\Utils
wp_clear_object_cache()
Устарела с версии 1.5.0. Больше не поддерживается и может быть удалена. Рекомендуется заменить эту функцию на аналог.
Clear WordPress internal object caches.
In long-running scripts, the internal caches on $wp_object_cache and $wpdb can grow to consume gigabytes of memory. Periodically calling this utility can help with memory management.
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
wp_clear_object_cache();
Список изменений
Устарела с | 1.5.0 |
Код wp_clear_object_cache() wp clear object cache WP-CLI 2.8.0-alpha
function wp_clear_object_cache() { global $wpdb, $wp_object_cache; $wpdb->queries = []; if ( ! is_object( $wp_object_cache ) ) { return; } // The following are Memcached (Redux) plugin specific (see https://core.trac.wordpress.org/ticket/31463). if ( isset( $wp_object_cache->group_ops ) ) { $wp_object_cache->group_ops = []; } if ( isset( $wp_object_cache->stats ) ) { $wp_object_cache->stats = []; } if ( isset( $wp_object_cache->memcache_debug ) ) { $wp_object_cache->memcache_debug = []; } // Used by `WP_Object_Cache` also. if ( isset( $wp_object_cache->cache ) ) { $wp_object_cache->cache = []; } }