WordPress at Your Fingertips
function is not described

WC_Widget::cache_widget() public WC 1.0

Cache the widget.

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

No Hooks.

Return

String. the content that was cached

Usage

$WC_Widget = new WC_Widget();
$WC_Widget->cache_widget( $args, $content );
$args(array) (required)
Arguments.
$content(string) (required)
Content.

Code of WC_Widget::cache_widget() WC 5.5.2

<?php
public function cache_widget( $args, $content ) {
	// Don't set any cache if widget_id doesn't exist.
	if ( empty( $args['widget_id'] ) ) {
		return $content;
	}

	$cache = wp_cache_get( $this->get_widget_id_for_cache( $this->widget_id ), 'widget' );

	if ( ! is_array( $cache ) ) {
		$cache = array();
	}

	$cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ] = $content;

	wp_cache_set( $this->get_widget_id_for_cache( $this->widget_id ), $cache, 'widget' );

	return $content;
}