Automattic\WooCommerce\Internal\AddressProvider
AbstractAutomatticAddressProvider::is_expired
Checks if the cache value is expired.
Метод класса: AbstractAutomatticAddressProvider{}
Хуков нет.
Возвращает
boolean. True if the contents are expired. False otherwise.
Использование
$result = AbstractAutomatticAddressProvider::is_expired( $cache_contents );
- $cache_contents(массив) (обязательный)
- The cache contents.
Код AbstractAutomatticAddressProvider::is_expired() AbstractAutomatticAddressProvider::is expired WC 11.2.2
private static function is_expired( $cache_contents ) {
if ( ! is_array( $cache_contents ) || ! isset( $cache_contents['updated'] ) || ! isset( $cache_contents['ttl'] ) ) {
// Treat bad/invalid cache contents as expired.
return true;
}
// Double-check that we have integers for `updated` and `ttl`.
if ( ! is_int( $cache_contents['updated'] ) || ! is_int( $cache_contents['ttl'] ) ) {
return true;
}
$expires = $cache_contents['updated'] + $cache_contents['ttl'];
$now = time();
return $expires < $now;
}