May 18, 2022

Make WPGraphQL 56% faster with one click with the new Stellate Edge Cache integration

Blog post's hero image

We've found that many of our clients use WordPress as their content management system and publish their data through the popular WPGraphQL plugin. Even though GraphQL makes life easier in many ways, one of the more difficult aspects of using it is properly configuring caching — whether it’s through long-term storage (that can get stale over time), manually checking data, or a combination of the two 😬. 

Setting up caching for WordPress can be a real pain

Time is a crucial concern while caching. If your data is immutable you could keep it in the cache indefinitely, but this is usually not the case, so you have to decide how & when to invalidate the cache based on your use case.

The content in a blog, for example, does not change regularly, but the data in the comment section does — in this instance the comment data will need to be invalidated from the cache on a regular basis to guarantee that the cache contains the most recent update. 

We feel your pain, so we went to work solving this issue and we're thrilled to announce our first out-of-the-box integration for the Stellate Edge Cache and WordPress!

How GraphQL edge caching makes WPGraphQL faster

At Stellate, we build a global GraphQL edge cache that allows you to cache your GraphQL API responses as close to your users as possible. The result? Much faster response times. Across our whole network of APIs, the Stellate Edge Cache speeds up WPGraphQL APIs p99 response time by 56%.

For example, one of our customers, Patronage, is already reaping the benefits of this Stellate Edge Cache + WPGraphQL combination. More about them and how GraphQL edge caching helped them can be found here.

How our WordPress plugin eases your burden

In a nutshell, our Stellate Edge Cache WordPress plugin hooks into all database operations (including creating, updating, and deleting entities) and invalidates any cached query results in the Stellate Edge Cache that contain those specific entities.

This integration is available as a WordPress plugin built on top of the WPGraphQL plugin. Once it's installed, you don't have to worry about configuring cache rules or ensuring that invalidation works properly. We take care of everything so that you can get the benefits of edge caching your GraphQL queries and always get served fresh data! 🙌

How does the plugin work?

Let's take a closer look at what our Stellate Edge Cache WordPress plugin does in the background. Here’s what it can do:

  • Hooks into database updates for any entity, using built-in actions such as wp_insert_post.

  • While processing requests, all entities that need to be purged are collected. We send a single HTTP request (or none at all if there’s nothing to be invalidated) to the Stellate Purging API with all of them.

  • In addition to the standard types, the plugin also supports automatic cache invalidation for all custom post types and taxonomies exposed via the GraphQL API.

How do I start using the Stellate Edge Cache WordPress plugin?

For you to be able to use the Stellate Edge Cache WordPress plugin, the only things you will need are:

  • A service on Stellate that links to your existing WPGraphQL API. The WordPress plugin is built on top of Stellate's infrastructure, so you'll need an account with Stellate to use GraphQL edge caching

  • Your WordPress site must use the WPGraphQL plugin, which makes your data queryable via a GraphQL endpoint.

  • You need to install our WordPress plugin. To get started, you can take a look at our documentation.

We're excited to make GraphQL caching more accessible to WordPress users with this plugin, and we're looking forward to adding more integrations in the future, so stay tuned for more! 👏