Automattic\WooCommerce\Blocks\Assets

Api::update_script_data_cache()publicWC 1.0

Store all cached script data in the transient cache.

Method of the class: Api{}

No Hooks.

Return

null. Nothing (null).

Usage

$Api = new Api();
$Api->update_script_data_cache();

Api::update_script_data_cache() code WC 9.8.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
	);
}