Websites, web applications, and APIs, they all speak HTTP. As a developer, most of us are familiar with HTTP but when it actually comes to creating cacheable web content, there is still a lot to be learned.
In this presentation, I will show you how to leverage specific headers to achieve a maximum hit rate without losing touch with some of the challenges of real-life web projects. These best practices will be illustrated by applying them to a Symfony 4 application.
The following topics will be covered:
- The syntax of cache-control headers
- How to use cache-control headers to control whether or not to cache
- How to use cache-control headers to control the time to life of our cached objects
- How to deal with cookies
- How to separate stateful from stateless content
- How to architect content blocks in your code using Edge Side Includes, HInclude, and AJAX
- How to boost your performance by adding a reverse cache proxy like Varnish
- How to invalidate your cache
- How to leverage content delivery networks
- How to create cache variations
- How to reduce backend load and bandwidth by performing conditional HTTP requests
- How to cache content for logged-in users by using JSON Web Tokens