Fragment caching works by identifying sections of code, which take up time and resources, and caching just those sections.