At bunny.net, we keep raving on and on about caching. We believe that efficient caching is one of the main keys to great performance. As such, we are constantly exploring how we can bring developers even more power to efficiently cache content on the edge with a goal to build the most powerful edge caching platform in the world. Just a few days ago, we announced Stale Cache Delivery which was just one of the updates that we are working on.
Today, we are excited to announce the next update as part of this effort. A simple, but powerful new update to our Vary Cache system. It brings the ability to select specific query string parameters to serve as part of the Vary By Query String setting.
Traditionally, CDNs only allowed caching based on the full query string list or no query strings at all. While this serves many uses cases very well, it can present a challenge in complex scenarios with dynamic content caching.
With the new update, we're unlocking a much more powerful way of efficiently caching dynamic content. The new system for example, allows you to pass query parameters back to the origin, but only cache requests based on a specific set of variables. Any parameter outside of the list are ignored and are only used to communicate with the origin server.
For example, in the past, each of these would cache separately:
image.jpg?width=400&version=1 image.jpg?width=400&version=2 image.jpg?width=400&version=3
With the new vary settings, you can easily configure width to be one of the only parameters counted. Then, the above requests would all get cached under a single key:
We developed this update while working together with one of our customers that was struggling with cache management. With the new update, we managed to simplify a complex system of millions of purge requests per day to a single configuration update on one of the zones while also greatly improving the performance.
We're excited to learn what other problems this will solve and help other companies develop a more efficient caching strategy. If you're working on a cool project powered by bunny.net, give us a shoutout on Twitter. We would love to learn more.
If you're struggling with complex problems on the edge and still looking for a simple solution, make sure to let us know as well. We love a challenge and developing innovative solutions and will be delighted to work with you to solve this.