clean_network_cache

函式
clean_network_cache ( $ids )
引數
  • (int|array) $ids Network ID or an array of network IDs to remove from cache.
    Required:
定義位置
相關方法
clean_user_cacheclean_term_cacheclean_category_cacheupdate_network_cacheclean_bookmark_cache
引入
4.6.0
棄用
-

clean_network_cache: 這個函式清除了網路的快取。在WordPress的多站點安裝中,這個函式清除所有與網路有關的資料的快取,包括站點資料、使用者資料和網路設定。

從物件快取記憶體中刪除一個網路。

function clean_network_cache( $ids ) {
	global $_wp_suspend_cache_invalidation;

	if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
		return;
	}

	$network_ids = (array) $ids;
	wp_cache_delete_multiple( $network_ids, 'networks' );

	foreach ( $network_ids as $id ) {
		/**
		 * Fires immediately after a network has been removed from the object cache.
		 *
		 * @since 4.6.0
		 *
		 * @param int $id Network ID.
		 */
		do_action( 'clean_network_cache', $id );
	}

	wp_cache_set( 'last_changed', microtime(), 'networks' );
}

常見問題

FAQs
檢視更多 >