“There are only two hard things in Computer Science: cache invalidation and naming things.” - Phil Karlton
Everyone’s heard the adage, but when people share this bit of wisdom the aim is to usually exemplify the difficulty in the latter. Naming things is hard. But as the things we build continue to grow in complexity, having the ability to fine tune the caching of the markup we render can have a huge impact on the overall performance of a page. And can also result in hours of frustrating debugging when items on the page don’t update as expected.
Drupal 8’s Cache API has made huge strides in allowing hyper-granular control over when any page item’s cache needs to be refreshed. This granularity comes largely set up out of the box, meaning for the majority of projects developers get performance benefits without extra effort. However, there are times when altering or implementing these cache rules will be necessary. In this talk we’ll take a look at:
`cache tags`, `cache contexts`, and `cache max-age` rules in Drupal.
The difference between render caching (fragment caching) and response caching in Drupal.
Leveraging Context Aware Plugins in custom development.
Overriding the caching rules of existing items.
This talk is for Drupal developers with some knowledge of caching and an interest in learning more about the Cache API.
James Nettik is a full-stack developer at Aten Design Group in Denver, Colorado. He's been building Drupal websites for nine years with a strong focus on responsive design and performance.