Index: src/wp-includes/class-wp-comment-query.php
===================================================================
--- src/wp-includes/class-wp-comment-query.php	(revision 40994)
+++ src/wp-includes/class-wp-comment-query.php	(working copy)
@@ -391,8 +391,11 @@
 			$this->meta_query_clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this );
 		}
 
+		$_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
+		unset( $_args['fields'] );
+
 		// $args can include anything. Only use the args defined in the query_var_defaults to compute the key.
-		$key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
+		$key = md5( serialize( $_args ) );
 		$last_changed = wp_cache_get_last_changed( 'comment' );
 
 
Index: tests/phpunit/tests/comment/query.php
===================================================================
--- tests/phpunit/tests/comment/query.php	(revision 40994)
+++ tests/phpunit/tests/comment/query.php	(working copy)
@@ -2870,4 +2870,75 @@
 		$this->assertSame( $num_queries, $wpdb->num_queries );
 		$this->assertEqualSets( array( $c ), $q->comments );
 	}
+
+	/**
+	 * @ticket 41348
+	 */
+	public function test_wp_comment_query_cache_with_count() {
+		global $wpdb;
+		$q = new WP_Comment_Query();
+
+		$query_1 = $q->query( array(
+			'fields'     => 'ids',
+			'number'     => 3,
+			'order'      => 'ASC',
+		) );
+
+		$number_of_queries = $wpdb->num_queries;
+
+		$query_2 = $q->query( array(
+			'fields'     => 'ids',
+			'number'     => 3,
+			'order'      => 'ASC',
+			'count'      => true,
+		) );
+		$this->assertEquals( $number_of_queries + 1, $wpdb->num_queries );
+	}
+
+	/**
+	 * @ticket 41348
+	 */
+	public function test_wp_comment_query_cache_with_both_count() {
+		global $wpdb;
+		$q = new WP_Comment_Query();
+
+		$query_1           = $q->query( array(
+			'fields'     => 'ids',
+			'number'     => 3,
+			'order'      => 'ASC',
+			'count'      => true,
+		) );
+		$number_of_queries = $wpdb->num_queries;
+
+		$query_2 = $q->query( array(
+			'fields'     => 'ids',
+			'number'     => 3,
+			'order'      => 'ASC',
+			'count'      => true,
+		) );
+		$this->assertEquals( $number_of_queries, $wpdb->num_queries );
+	}
+
+	/**
+	 * @ticket 41348
+	 */
+	public function test_wp_comment_query_cache_with_different_fields() {
+		global $wpdb;
+		$q                 = new WP_Comment_Query();
+		$query_1           = $q->query( array(
+			'fields'     => 'all',
+			'number'     => 3,
+			'order'      => 'ASC',
+		) );
+		$number_of_queries = $wpdb->num_queries;
+
+		$query_2 = $q->query( array(
+			'fields'     => 'ids',
+			'number'     => 3,
+			'order'      => 'ASC',
+		) );
+
+		$this->assertEquals( $number_of_queries, $wpdb->num_queries );
+
+	}
 }
