WordPress at Your Fingertips
function is not described

WC_Widget::get_cached_widget() public WC 1.0

Get cached widget.

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

No Hooks.

Return

true|false. true if the widget is cached otherwise false

Usage

$WC_Widget = new WC_Widget();
$WC_Widget->get_cached_widget( $args );
$args(array) (required)
Arguments.

Code of WC_Widget::get_cached_widget() WC 5.5.2

<?php
public function get_cached_widget( $args ) {
	// Don't get cache if widget_id doesn't exists.
	if ( empty( $args['widget_id'] ) ) {
		return false;
	}

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

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

	if ( isset( $cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ] ) ) {
		echo $cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ]; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
		return true;
	}

	return false;
}