WC_Admin_Report::set_cached_query
Set the cached query result.
Method of the class: WC_Admin_Report{}
No Hooks.
Returns
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() WC Admin Report::set cached query code WC 10.5.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;
}