No quite: Get the transient’s content first, then do the expensive work to fetch the external resource.
function google_transient() {
$transient_name="google";
$content = get_transient( $transient_name );
// done
if ( $content )
return $content;
$url="http://www.google.com";
$content = wp_remote_retrieve_body( wp_remote_get($url) );
set_transient( $transient_name, $content, DAY_IN_SECONDS ); // 24 hour cache
return $content;
}