Cloudflare optimized the DNS cache of their 1.1.1.1 service, reducing memory usage by 100 terabytes. The optimization involved changing how cache entries are stored in memory, including replacing Vec with Box and reducing the number of lists and pointers. This change also improved the cache's performance, with a 43% increase in insert throughput and a 19% decrease in lookup latency. The optimization was achieved through a series of five successive changes to the cache's data structure.