3/17/2023 0 Comments Drupal 8 cache contexts![]() ![]() It's important not to assume that every bit of custom code will cache perfectly on its own - that's a mistake that could lead to something being cached either for too long or not at all. Often, the implications will be minimal, if there are any at all. This isn't ideal if you want to take advantage of Drupal's caching system to optimize your site's speed, and it points to one principle which can be tricky to learn and is critical to master: If you write custom code, always think about its caching implications. Perhaps the most frequent issue custom code has when it comes to caching is that it doesn't account for caching at all. This article focuses on some more complex and custom scenarios which, nonetheless, come up with some frequency. If you're using a simple Drupal installation with no custom code and with well-maintained contributed modules, Drupal's Internal Page Cache and Dynamic Internal Page Cache modules will likely cover your caching needs. If you're familiar with those things, then this post is for you otherwise, check out my previous article and get up to speed before we dive into a slightly more in-depth topic: Figuring out how you should set up caching on your site. I previously covered the fundamentals of how caching works in Drupal 8, including what the two core caching modules do and what cache tags, contexts, and max-age are for. ![]() In the right hands, the techniques outlined in this article can get a website into a much more specialized caching system. The improved page load times that come from properly handling caching rules can help improve SEO and are generally more appealing to those that visit the website. It all starts with figuring out what sort of rules your site should use to cache its content. Leveraging Drupal's cache effectively can be challenging at first, but the benefits for your site's performance make it well worth the effort. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |