Automattic\WooCommerce\Caching

ObjectCache::verify_expiration_value()privateWC 1.0

Check if the given expiration time value is valid, throw an exception if not.

Method of the class: ObjectCache{}

No Hooks.

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->verify_expiration_value( $expiration ): void;
$expiration(int) (required)
Expiration time to check.

ObjectCache::verify_expiration_value() code WC 7.1.1

private function verify_expiration_value( int $expiration ): void {
	if ( self::DEFAULT_EXPIRATION !== $expiration && ( ( $expiration < 1 ) || ( $expiration > self::MAX_EXPIRATION ) ) ) {
		throw new CacheException( 'Invalid expiration value, must be ObjectCache::DEFAULT_EXPIRATION or a value between 1 and ObjectCache::MAX_EXPIRATION', $this );
	}
}