Brewing Better Website Performance: How Object Caching Works

In the world of website performance, caching is a key ingredient to ensure content is delivered quickly and efficiently to visitors. Using a delightful cup of coffee, we can explore the nuanced layers of how caching works and its importance in running a successful website. 

A Quick Primer on Coffee and Caching 

Imagine each morning, hundreds of workers arrive at the office eager for their first cup of coffee. Without pre-ground coffee, each person would need to wait in line as the whole beans are ground for their individual cup. This is like a server processing data requests on the fly – a time-consuming task that creates a bottleneck, causing long waits and a slow start to the day. 

Pre-ground coffee in this scenario is akin to object caching, where the coffee grounds are the data, and the workers are users making requests. 

The coffee bar has a large container (or cache) that keeps a substantial amount of coffee grounds ready. When someone comes to the coffee bar, they simply brew the coffee, bypassing the grinding process entirely. This represents a user making a request to a system, and instead of fetching data from a database, it’s able to quicky retrieve the result from the cache. 

How Object Caching is Implemented 

Alright, let’s set our cup down for a sec and get right into it. 

Object caching can be implemented through a variety of caching backends like Memcached or Redis. These are advanced, in-memory data storage systems that provide fast access to cached objects.

Quick note: Object caching stores pieces of data (for example, database query results), while page caching stores full HTML pages; they’re complementary and are often used together for the best results.

When a user visits a WordPress site, the system typically needs to run several database queries to render a page. Object caching stores these query results in a cache pool, which can be quickly accessed for subsequent requests. These systems are optimized to keep frequently accessed (“hot”) data in memory, which is especially helpful during high‑demand periods, reducing trips to the database. This significantly reduces a server’s processing time, resulting in faster load times for users. By default, WordPress’ built‑in object cache is not persistent (it resets each page load), so using Redis or Memcached makes the cache persistent across requests for bigger wins.

Why WordPress Sites Benefit from Object Caching 

Object caching offers several advantages that can greatly enhance the performance and scalability of a WordPress site. 

Improved Page Load Times 

One of the most significant benefits is the reduction in page load times. By reducing the number of database queries needed for each page, object caching decreases the time it takes for pages to render and become interactive for the user. 

Handling High Traffic 

During times of high traffic, object caching can prevent a website from becoming sluggish or unresponsive by decreasing the server load. This is especially critical for websites with large amounts of dynamic content or those that experience sudden spikes in traffic. 

Dynamic Content Delivery 

Object caching is particularly beneficial for websites that offer personalized content. It enables dynamic elements of web pages to load quickly because the individual pieces of data required to personalize content for different users are readily available in the cache. For fully personalized pages where full‑page caching isn’t feasible, object caching still speeds up the building blocks (e.g., user profiles, menus, query results) and is refreshed when content changes.

How Pagely Handles Caching 

So, how does Pagely fit into this coffee-fueled analogy? Well, we’re like the coffee supplier who not only provides the beans but also grinds them for you. Our custom approach to caching ensures that your website always serves up the freshest, fastest data – no matter how complex. 

PressCACHE 

PressCACHE, our proprietary caching solution, harnesses the strength of NGINX’s robust technology to significantly boost the speed of WordPress sites. Easily managed directly within WordPress admin, users can toggle the caching on or off and engage developer mode with simplicity (developer mode temporarily bypasses caching so you can preview changes and debug). 

When someone visits a page, PressCACHE determines if it can use a saved version of the page for faster loading, while making sure it doesn’t mistakenly use saved data for things that change from user to user, like login details or comments (e.g., pages for logged‑in users, carts, or comment previews). If no cached copy exists when requested, the system will process the request and cache the page after it’s generated, provided no errors occur and no user‑specific cookies are present (like login, cart, or comment cookies), enhancing the site’s performance with minimal user intervention. In other words, we’ve got caching covered, so your site can serve up content faster than you can say ‘double espresso’. For more on this, check out our PressCACHE article

Object Cache Pro 

Partnering with Object Cache Pro, we’ve fine-tuned our approach to object caching. It’s like working with a world-class barista to create the perfect cup of coffee every time. See, Object Cache Pro harnesses the cutting-edge Zstandard compression technology developed by Facebook, achieving high levels of compression with minimal CPU usage. This reduces the memory footprint of cached data so Redis can hold more while keeping CPU overhead low. This advanced process is handled at the extension level, facilitating direct communication with Redis, which results in the need for less hardware, reduced expenses, and enhanced user experience. 

In addition to employing the Zstandard algorithm, Object Cache Pro adopts the igbinary serializer, an alternative to PHP’s default serialization mechanism. The igbinary serializer can serialize and unserialize data at nearly double the speed of the standard method. Moreover, it generates a more compact data size, leading to a decrease in memory consumption by the Redis service, which means faster responses and more cache entries fitting into the same RAM.

Combining Forces 

Now, understanding how Object Cache Pro interacts with PressCACHE is key. Object Cache Pro handles direct PHP caching for WordPress and its plugins, preparing the object cache for each page load. In practice, this cuts down database queries and PHP work when WordPress assembles a page. This sets the stage for PressCACHE to save a streamlined version of the page, then when appropriate, PressCACHE serves that full HTML response to future anonymous visitors, skipping PHP entirely and contributing to faster page loads. Together, they offer a comprehensive caching solution, enhancing WordPress performance while saving time and money. 

Did we mention the added benefit of passing on our cost savings to you? Explore our Object Cache Pro partnership post for more details and discover how we’ve created an optimal WordPress experience.

Chat with Pagely

New Posts in your inbox