(202) 750-1910
  • Facebook
  • X
  • Instagram
  • TikTok
  • Yelp
  • Google
  • Pinterest
  • WhatsApp
  • Threads
  • Facebook
  • X
  • Instagram
  • TikTok
  • Yelp
  • Google
  • Pinterest
  • WhatsApp
  • Threads
0 Items
Ask the Egghead, Inc.
  • Home
  • About
    • Reviews
    • Awards
    • Careers
    • Partners
    • Systems Status
  • Services
    • Website Design
    • Managed Hosting
    • Accessibility Compliance
    • Content Builder
    • Multi-Language Websites
    • SEO
    • Social Media
    • Premier Property Promotion
    • Reputation & Review Management Services
    • Low Code/No Code Solutions for MVP Development
    • Citation Builder
    • Pricing
    • Get A Quote
  • Portfolio
  • Website Audit
  • Blog
  • Invest Local
  • Contact
Select Page

What Is the WordPress Object Cache?

Speed is crucial to your site’s success. Slow loading times can drive visitors away, resulting in a high bounce rate and fewer conversions. Fortunately, an effective way to boost your site’s performance is to use the WordPress object cache.

In this post, we’ll take a closer look at object caching and how it works. We’ll then show you how to use the WordPress object cache on your site. Let’s get started!

What Is Object Caching?

Caching is the process of storing data and files in a cache. When a user visits a page, the content is delivered quicker since the browser doesn’t need to retrieve the entire site from scratch.

There are different types of caching. You may have already heard of page caching. This is when the browser stores static HTML versions of a page.

However, there’s also object caching. This process involves storing database queries to serve a specific piece of data on the subsequent server request. As a result, there will be fewer queries sent to the database.

Object caching is a type of server-side caching. This term means that the cache is stored on the server, not on the user’s browser (as with client-side caching).

Let’s break down the process:

  1. When a user accesses your site, their browser sends a data request to your server.
  2. The server receives the request and delivers the data (or object) to the browser.
  3. If you have object caching enabled on your site, the server will create a copy of this request in your cache.
  4. When a similar request is made again, it will be served from the cache rather than the database.

Therefore, object caching minimizes the number of times the server has to query the database. This setup can reduce the load on your server, especially during peak traffic times. Therefore, it can lead to faster loading times and a smoother User Experience (UX).

What Is the WordPress Object Cache?

WordPress has a built-in object cache. WP_Object_Cache is a WordPress class that can automatically store any data from the database in PHP memory. This way, it can prevent repeated and unnecessary queries to the database.

These cached objects can be accessed and retrieved using a key. This is a unique value that identifies a particular entry in the database.

By default, the WordPress object cache is non-persistent, meaning that it only stores data for a single page load. The objects in the cache will be discarded once the request is over.

For this reason, you might want to consider using a persistent caching tool. With this tool, objects will be cached across multiple page loads, further improving performance. We’ll take a closer look at this setup later in the post.

How to Use WP_Object_Cache on Your Site

Now that you have a better understanding of object caching and its importance, let’s look at how to enable it on your WordPress site. Note that this caching mechanism should already be enabled by default. However, you might want to make sure it’s working correctly.

To get started, you’ll need to connect to your site’s back end via an FTP client like FileZilla. Alternatively, you can use the file manager in your hosting account dashboard.

Once you’ve connected to your site, navigate to the root directory (usually public_html) and locate the wp-config.php file:

Locating the wp-config.php file in the site directory

Right-click on the file and select View/Edit to open it in a text editor. Then, make sure that the value for ENABLE-CACHE is set to “true” so that the line looks like this:

define('ENABLE_CACHE', TRUE);

When you’re ready, save your changes and close the file. Then, open the wp-content folder in your site’s directory, and look for the cache folder. If it’s not there, you can go ahead and create one:

Creating a cache folder in the site's directory

Next, you’ll want to see the folder’s permissions to ensure it’s writable. To do this, right-click on the folder and select File permissions. The Numeric value field should be set to 755 or 777:

Checking the file permissions

Now, it’s time to verify that the WordPress object cache is working correctly. Go to your website and try reloading a few pages. Then, open the cache folder you’ve just created, and you should find some newly created files:

Files inside the Cache folder

That’s it! If you decide to disable the object cache in the future, just open the wp-config.php file and set the value for ENABLE-CACHE to “false.”

Adding a Persistent Caching Tool

As mentioned earlier, the WordPress object cache only stores data for the duration of the request. However, you can use an additional tool such as Redis for persistent object caching between requests:

The Redis homepage

Redis is a powerful in-memory caching solution that can help reduce the load on your MySQL database, leading to faster response times. It can be an essential tool for your site if you’re scaling up or receiving higher traffic.

If you’re on a managed WordPress hosting plan, you might want to ask your web host if they offer object caching via Redis. Some hosting providers like Cloudways offer a Redis add-on to help speed up your website. However, you can also install the Redis server manually on your computer.

Once you’ve connected to Redis, you can add the Redis Object Cache plugin to your site:

The Redis Object Cache plugin

After installing and activating the plugin, navigate to Settings > Redis in your dashboard:

Enabling Object Cache in Redis

Make sure the server has been successfully installed. If you’re unable to connect, you might want to verify with your web host that your site’s server is compatible with Redis. Finally, click on the Enable Object Cache button.

Conclusion

Object caching involves storing database queries. The server can then deliver similar data requests from the cache, minimizing the number of queries sent to the database. This setup can lead to faster response times.

WordPress has an in-built object caching mechanism known as WP_Object_Cache. However, this feature only stores data for the duration of the request. For persistent object caching, you’ll need to install a tool like Redis. It can further reduce the load on your server and speed up your site.

Do you have any questions about the WordPress object cache or WP_Object_Cache? Let us know in the comments section below!

Featured image via hanss / shutterstock.com

The post What Is the WordPress Object Cache? appeared first on Elegant Themes Blog.

Recent Posts

  • 7 Website Mistakes That Hurt Your Business

    7 Website Mistakes That Hurt Your Business

  • How AI Helps Us Help You

    How AI Helps Us Help You

  • Future-Proof Your WordPress Site in 2025

    Future-Proof Your WordPress Site in 2025

  • Why You Need Managed WordPress Hosting from Ask the Egghead

    Why You Need Managed WordPress Hosting from Ask the Egghead

  • Your Website Is More Than Just Curb Appeal

    Your Website Is More Than Just Curb Appeal

  • Top Website Mistakes That Hurt Your Business

    Top Website Mistakes That Hurt Your Business

  • Plugin of the Week: WPForms Made Simple

    Plugin of the Week: WPForms Made Simple

  • SEO Simplified: Boost Your Website Without Tech Skills

    SEO Simplified: Boost Your Website Without Tech Skills

  • Find Your Perfect Website Style

    Find Your Perfect Website Style

  • SEO Promises That Should Scare You

    SEO Promises That Should Scare You

Awards

  • Clutch Top Web Design Company Medical Websites 2024

    Clutch Top Web Design Company Medical Websites 2024

  • Clutch Top Web Design Company Government Websites 2024

    Clutch Top Web Design Company Government Websites 2024

  • UpCity National Excellence Winner 2024

    UpCity National Excellence Winner 2024

  • UpCity National Excellence Winner 2023

    UpCity National Excellence Winner 2023

  • UpCity National Excellence Winner 2022

    UpCity National Excellence Winner 2022

  • UpCity Local Excellence Washington DC 2021

    UpCity Local Excellence Washington DC 2021

  • UpCity Top Designer 2021

    UpCity Top Designer 2021

  • DesignRush Accredited Agency 2021

    DesignRush Accredited Agency 2021

  • Clutch Top Company Washington DC 2021

    Clutch Top Company Washington DC 2021

  • Digital.com Best SEO Firms Washington DC 2021

    Digital.com Best SEO Firms Washington DC 2021

Ask-the-Egghead-logo

Capability Statement

View/Download

Ask the Egghead

200 Massachusetts Ave NW
8th Floor Suite 133
Washington, DC 20001
(202) 750-1910

Ask the Egghead

399 Boylston Street
Suite 685
Boston, MA 02116
(617) 221-8300

Quick Links

  • Website Design
  • Social Media
  • SEO
  • Managed Hosting
  • Privacy Policy
  • Investors
  • Facebook
  • X
  • Instagram
Designed by The Egghead © 2015-2025 Ask the Egghead, Inc.