Drupal 8 Cache API and Tacos - a Delicious Real-World Example!


In this presentation we introduce Drupal 8's Cache API, review its metadata settings and demonstrate D8's caching flexibility using a fun, real-life example. The fun part is in the form of tacos because they're the de facto currency of the HeyTaco! Slack integration, from which we will grab our cacheable data. The idea is to discuss the Cache API and give a practical example of Drupal 8 caching in action. Since this presentation is geared for beginners, there's added value for the audience in seeing the many moving parts that are used along the way!

Main Focus:

  • Explain D8 Cache metadata settings

    • keys

    • context

    • tags

    • max-age

  • Demonstrate how we can cache results differently for different users

  • Stress the importance of using render arrays

Added Value:

  • Build a custom module to create the custom block to be cached
  • Grab data from a 3rd party API
  • Use Twig to display the custom block's output

This presentation makes no assumptions and begins with the question "Why cache at all?" From that modest beginning we progress through all the above points and finally reach our Cache-tastic conclusion. The title is about caching and tacos, but the presentation is about so much more!

Original Blog Post (Feb 2017)

A Taco-Friendly Guide to Cache Metadata in Drupal 8


Session Track

Back End Development

Experience Level


Drupal Version

When & Where

Tuesday, 10 April, 2018 - 16:20 to 16:45
202 | Acquia