WC_Admin_Report::set_cached_query()protectedWC 1.0

Set the cached query result.

Method of the class: WC_Admin_Report{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->set_cached_query( $query_hash, $data );
$query_hash(string) (required)
The query hash.
$data(mixed) (required)
The data to cache.

WC_Admin_Report::set_cached_query() code WC 8.7.0

protected function set_cached_query( $query_hash, $data ) {
	$class = strtolower( get_class( $this ) );

	if ( ! isset( self::$cached_results[ $class ] ) ) {
		self::$cached_results[ $class ] = get_transient( $class );
	}

	if ( false === self::$cached_results[ $class ] ) {
		self::$cached_results[ $class ] = array();
	}

	self::add_update_transients_hook();

	self::$transients_to_update[ $class ]          = $class;
	self::$cached_results[ $class ][ $query_hash ] = $data;
}