Automattic\WooCommerce\Blocks\Assets
Api::update_script_data_cache
Store all cached script data in the transient cache.
Method of the class: Api{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Api = new Api(); $Api->update_script_data_cache();
Api::update_script_data_cache() Api::update script data cache code WC 11.0.1
public function update_script_data_cache() {
if ( is_null( $this->script_data ) || $this->disable_cache ) {
return;
}
if ( ! $this->script_data_modified ) {
return;
}
set_transient(
$this->script_data_transient_key,
wp_json_encode(
array(
'script_data' => $this->script_data,
'version' => $this->wc_version,
'hash' => $this->script_data_hash,
)
),
DAY_IN_SECONDS * 30
);
}