The Giants drafted Cain out of high school in 2002, and he made his MLB debut at age 20 in , becoming the youngest player in the National League (NL) that year. In 2009, Cain was named to his first career All-Star Game and won the Willie Mac Award. During the 2010 MLB postseason, he did not allow an earned run in any of the three playoff games he pitched in as the Giants won their first World Series since 1954. In 2012, Cain signed a contract extension that, at the time, gave him the most lucrative contract ever received by a right-handed pitcher in major league history. Cain threw the 22nd perfect game in big league history on June 13, 2012. He had a 16–5 record during the 2012 regular season, finishing sixth in NL Cy Young Award voting. During the Giants' playoff run that led to their victory in the 2012 World Series, the team won every series-clinching playoff game that Cain started. Cain ended his pitching career in 2017.