Automattic\WooCommerce\Internal\AddressProvider

AbstractAutomatticAddressProvider::update_cached_optionprivateWC 1.0

Updates the cached option.

Method of the class: AbstractAutomatticAddressProvider{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->update_cached_option( $key, $value, $ttl );
$key(string) (required)
The key of the option.
$value(mixed) (required)
The value of the option.
$ttl(int)
The TTL of the option.
Default: DAY_IN_SECONDS

AbstractAutomatticAddressProvider::update_cached_option() code WC 10.3.3

private function update_cached_option( $key, $value, $ttl = DAY_IN_SECONDS ) {
	$result = update_option(
		$this->id . '_' . $key,
		array(
			'data'    => $value,
			'updated' => time(),
			'ttl'     => $ttl,
		),
		false
	);
	if ( false === $result ) {
		wp_cache_delete( $this->id . '_' . $key, 'options' );
	}
}