Magento 2 plugin released!


We're kicking goals getting our plugins feature complete and into market places. Today marks the release of our Magento 2 plugin. Unlike Magento 1, version 2 is built specifically with full page caching in mind. This made the scope for building this plugin much simpler as we just had to integrate with the inbuilt caching functionality. However it did mean we had to implement support for custom cache tags in our service. Cache tags are typically only available on Enterprise plans from our competitors, however every Peakhour customer can use it regardless of plan.

What are cache tags?

One of the big problems of caching content is letting the cache know when that content has changed. Magento 2 is a very modular system which builds up content from a host of reusable components. If you update one product's price this might need to be reflected on the product page, the category page for the product, and search results that show the product. How do you inform the cache that this content needs to be flushed and a new copy retrieved from the origin server?

Magento's solution is to associate every component that makes up a page with a unique identifier, or tag. For example a given category will have its own tag, a product has its own tag, the navigation menu, the sidebar and so on. When a page is built all these tags are collected from the components that make up the page and returned in a custom header. The idea is that the value of this custom header is stored by the caching application and when say, a product page is changed a flush is issued for the product's tag. The cache can then query its store for any page that has that tag and flush only that content. It's a very effective method for ensuring only relevant content is cleared, making sure your cache hit rate remains high and server load low.

Our own cache only supported the url as the cache key, we added the ability to specify a header name and a tag separater so we could store custom cache tags along with the URL, this means we can also support other applications with a similar caching method, eg Drupal.

Grabbing the plugin

You can grab the plugin in a couple of different ways. The easiest is via Magento Connect, we also support installation via composer or via a ZIP file. Check out our plugin page for more information! Please note that while we haven't tested Magento 2.0.x the plugin will probably still work with it.

Website Performance Magento 2 Plugins

© PEAKHOUR.IO PTY LTD 2023   ABN 76 619 930 826    All rights reserved.