Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailTemplateChangeSummary::cache_key
Compute the transient key.
Hash composite is md5-wrapped to keep option_name (with the _transient_ prefix) well under WP's 191-char limit.
Method of the class: WCEmailTemplateChangeSummary{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WCEmailTemplateChangeSummary::cache_key( $post_id, $post_hash, $core_hash, $base_hash, $locale ): string;
- $post_id(int) (required)
- The
woo_emailpost ID. - $post_hash(string) (required)
- sha1 of the persisted post content.
- $core_hash(string) (required)
- sha1 of the canonical core render.
- $base_hash(string) (required)
- sha1 of
_wc_email_template_last_core_renderif set; empty string otherwise. Including this in the key invalidates the cache when base shifts. - $locale(string) (required)
- Active locale.
WCEmailTemplateChangeSummary::cache_key() WCEmailTemplateChangeSummary::cache key code WC 10.9.1
private static function cache_key( int $post_id, string $post_hash, string $core_hash, string $base_hash, string $locale ): string {
return sprintf(
'wc_email_change_summary_%d_%s',
$post_id,
md5( $post_hash . '|' . $core_hash . '|' . $base_hash . '|' . $locale )
);
}