/** * Invalidation * * @param object $cf_client * @param array $query * @access private * @since 4.3.0 * @return boolean | WP_Error **/ private function _do_invalidation($cf_client, $query) { try { set_transient(self::C3_INVALIDATION_KEY, true, 5 * 60); $result = $cf_client->createInvalidation($query); return true; } catch (Aws\CloudFront\Exception\TooManyInvalidationsInProgressException $e) { error_log($e->__toString(), 0); $e = new WP_Error('C3 Invalidation Error', $e->__toString()); return $e; } catch (Aws\CloudFront\Exception\AccessDeniedException $e) { error_log($e->__toString(), 0); $e = new WP_Error('C3 Invalidation Error', $e->__toString()); return $e; } catch (Exception $e) { $e = new WP_Error('C3 Invalidation Error', $e->getMessage()); error_log($e->get_error_messages(), 0); return $e; } }