1. Home
  2. Performance
  3. How Does Pagely’s Caching Layer…

How Does Pagely’s Caching Layer Work?

Our PressCACHE™ service is backed by NGINX‘s powerful and robust caching technology. This is a key component of our architecture that produces extremely fast performance for your WordPress sites, while helping maximize the scalability potential of your Pagely VPS. Let’s do a quick overview of how our full-page NGINX caching layer works:

How Our Caching Layer Works:

A visitor arrives at a page on your site. We decide if it’s safe to serve them a cached page based on the following criteria:

  • If they are logged into WordPress we can’t, since the toolbar etc. with user-specific content could be on the page.
  • If they have a cookie marking them as commented we can’t cache (all the comment forms will be populated with the user’s email/name).
  • If they have a PHP session started we can’t cache, since the page might be pulling a value that is unique to that user from that session, and caching that would expose private data.
  • We also make sure it’s a GET request since we wouldn’t want to cache a from POST.

If it’s safe to serve a cached page, we build a key that represents that page (URL, HTTP/HTTPS, browser type) and check if we have a copy in the cache. If we do, we serve from that. If we don’t have a page in the cache, we hit PHP, generate a new copy, and if possible, add it to the cache before serving the results (if the page sets a cookie, or returns an error we don’t cache it).

Customizing Your Caching Rules

Both our CDN and caching layers are integrated into your WordPress instance such that it refreshes the relevant assets automatically when you publish or modify a post. This allows us the control to make custom rules for your specific WordPress sites.

With added flexibility, we can still create to an extent a more personalized user experience for your visitor. These types of modifications would be made on the client side. The base page would be cached therefore you’d need to make an API call to get the data to do the personalization on top of that. You are able to set cookies via javascript, just not via PHP.

The Importance of Optimizing Your WordPress Site

Depending on your unique site’s content, code efficiency and other variables, our caching layer has the capability of serving thousands of requests per second. Compare this to the PHP layer which can serve roughly ten requests per second. For easy scaling, we recommend maximizing the cache usage and only use PHP for things that truly need to be dynamic.

Identifying and implementing these tweaks are what our team of experts is here for. We encourage our customers to pick our brains and monitor how we can achieve better results for your website. Just send in a support ticket if you’re working to improve performance and we’ll be happy to consult with you.

Was this article helpful?