DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk11 min

What Is Object Cache in WordPress? How to Enable and Verify Persistent Caching

WordPress object cache reduces repeated database work. This guide explains request-scoped versus persistent caching, compares Redis, Memcached and local options, and shows how to configure, secure, flush and verify an object-cache drop-in.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

WordPress object cache stores frequently used database results in memory so WordPress can reuse them instead of rebuilding the same values on every request. Core WordPress provides an object-cache API, but its default cache lasts only for the current PHP request. To keep values between page loads, you need a persistent object-cache integration that installs an object-cache.php drop-in in wp-content.

Redis and Memcached are common backends, while PHP-based options such as Docket Cache and SQLite Object Cache can work where running a separate cache server is impractical. The safest setup is one you can verify in Site Health or WP-CLI and secure behind authentication and network controls.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What WordPress object cache does

WordPress describes its object cache as a way to “save on trips to the database.” During a request, core and plugins repeatedly ask for values such as options, post metadata, user data, taxonomy relationships, and query results. The object-cache API stores those values under keys in memory. If the same key is requested again, WordPress can return the cached value instead of issuing another database query or recalculating the result.

This is different from caching a complete HTML page. Object caching stores individual data objects for reuse by PHP code; page caching stores a finished response that can sometimes be served without running WordPress at all.

Core object caching is normally request-scoped

Out of the box, WordPress keeps object-cache values in PHP memory for the current request. At the end of that request, the values disappear. The next page load starts with an empty in-process cache and performs the database work again.

That behavior is intentional and does not mean the object-cache API is broken. It gives WordPress and plugins a standard interface while leaving persistence to an optional drop-in. Persistent object caching changes the lifetime of selected values so they can be reused by later requests and, when configured appropriately, by other PHP workers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What makes the cache persistent

A persistent integration supplies an object-cache.php file in wp-content. WordPress loads this drop-in during bootstrap, replacing the default in-memory implementation with one that writes to an external or local cache store. Without that drop-in, installing a Redis server or defining a constant does not make WordPress persistent.

Object cache, page cache and browser cache are different layers

These layers can coexist because they solve different bottlenecks:

Layer What it stores What happens on a cache hit Typical limitation
Object cache Individual values used by PHP, addressed by cache keys WordPress receives a value without repeating database or computation work PHP still runs; a bad key or stale value can affect application logic
Page cache A generated HTML response for a URL and request context The web server or cache serves the response without running most of WordPress Personalized, logged-in or rapidly changing pages need exclusions or short lifetimes
Browser cache Files and responses retained by a visitor’s browser The browser reuses a local copy It helps that visitor only and cannot replace server-side caching
Asset or CDN cache Static files such as CSS, JavaScript, images and fonts at edge locations A nearby edge or proxy serves the file Invalidation and cache-control rules must match deployments

Persistent object caching and page caching are separate systems. A plugin that offers both may install several components, so check exactly which layer is active instead of assuming a page-cache hit proves that object caching works.

When persistent object caching is useful

Object caching is most valuable when the site performs repeated database reads or expensive calculations across requests. Common examples include large catalogs, membership sites, busy content sites, complex navigation, WooCommerce-like product data, and plugins that assemble the same settings or relationships on many requests.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The benefit is workload-dependent. WordPress does not publish a universal speed-up percentage, and a cache can provide little visible improvement on a small, mostly static site or one whose bottleneck is slow external APIs, PHP execution, images, or network latency. Measure your own workload rather than treating persistent caching as a guaranteed score increase.

Choose a backend before installing anything

Start by asking what your host supports. You need either a reachable Redis or Memcached service with the required PHP extension, or a supported local implementation such as Docket Cache or SQLite Object Cache. The integration’s documentation should state the PHP version, extension, server and multisite requirements.

Option Infrastructure Operational profile Security and scaling considerations Other cache layers
Redis A Redis service and the PHP Redis client/extension required by the integration Well suited to shared, persistent caching; requires service configuration, monitoring and connection management Restrict the service to authorized hosts, require authentication where supported, and keep it off the public internet Some WordPress cache plugins bundle page, browser, asset or CDN features, but Redis itself is an object store
Memcached A Memcached service and its required PHP extension Simple high-speed key/value caching; your host or operations team must run and size the service Use a private network or firewall. Memcached must not be exposed publicly Bundled features depend on the WordPress plugin, not on Memcached
Docket Cache Local PHP-based storage according to the supported implementation Can avoid a separate cache server; capacity and concurrency depend on the host and configuration Protect the storage location and test behavior under your site’s load The implementation may focus on object caching; verify whether any page or browser cache is included
SQLite Object Cache PHP with SQLite support and the integration’s required filesystem access Useful where a local database-backed cache is preferable to another daemon File permissions, locking and disk reliability matter; do not expose the database file Object caching is separate from any page-cache feature supplied by a plugin

The table describes the general architecture. Exact support, extension names, multisite behavior and global-group handling come from the drop-in or plugin you select. If a site uses multiple web servers, confirm that every worker can reach the same cache service; a local file or SQLite cache on one server is not automatically shared with the others.

How to enable persistent object caching

1. Confirm host and PHP prerequisites

  1. Identify the PHP version used by the site and whether the host provides Redis or Memcached as a service.
  2. Confirm that the corresponding PHP extension is enabled for the same PHP runtime that runs WordPress. A command-line PHP binary and the web-server PHP process can load different extensions.
  3. If no daemon is available, check whether a supported local implementation can write to its storage path and whether the host permits the required PHP or SQLite functionality.
  4. For multisite or a load-balanced installation, determine whether the backend is shared and how the integration treats network-wide or global groups.

2. Install one compatible integration

Install a maintained WordPress plugin or drop-in that explicitly supports your chosen backend and WordPress version. Follow its installation procedure rather than copying an arbitrary object-cache.php file from another site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

After activation, look for wp-content/object-cache.php. A persistent integration should place the drop-in there. Do not install two competing object-cache drop-ins; only one file with that name can be loaded, and plugins may overwrite one another.

3. Configure the connection

Enter the values required by the integration: host name or socket, port, credentials, optional database index, timeouts and a unique key salt or prefix. A unique salt prevents two WordPress installations that share a backend from reading each other’s keys.

Use environment variables or protected configuration where the integration supports them. Avoid committing passwords to a public repository or placing them in files that can be downloaded by the web server.

4. Secure Redis or Memcached

  • Bind the service to a private interface or private network, not a public address.
  • Allow connections only from the web or application hosts through firewall rules.
  • Enable authentication and encryption options supported by your service and integration.
  • Use a distinct key prefix or salt for each WordPress installation.
  • Review logs for rejected connections, authentication failures and unexpected clients.

The WordPress Hosting Handbook specifically warns that Redis should be reachable only by authorized hosts and that Memcached must not be exposed to the public internet. A cache may contain user, session or configuration data even though it is not the primary database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Understand the role of WP_CACHE

WP_CACHE is commonly associated with caching plugins, but defining it does not automatically enable Redis or Memcached. It does not install a persistent drop-in and, by itself, does not improve performance. Treat it as a flag used by some page-cache integrations, not as a substitute for object-cache setup.

6. Flush after changing the configuration

Flush the old cache when changing the backend, host, credentials, key prefix or drop-in. Cache entries are regenerable; a flush should make WordPress rebuild values, not delete posts, pages, users or other primary content. If a plugin offers separate page-cache and object-cache flush controls, use the object-cache control for this change and clear page cache only when your deployment requires it.

How to verify that object caching is working

Use WordPress Site Health

Open Tools → Site Health → Info in the WordPress admin and inspect the caching or drop-in information exposed by your WordPress version and active plugins. You are looking for evidence that a persistent object-cache drop-in is present and that the configured backend is connected. A generic “caching” notice or a page-cache status is not sufficient proof.

Use WP-CLI

Run these commands from the WordPress installation, using the same site and PHP environment as the web process where possible:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wp cache type
wp cache supports
wp cache get example_key
wp cache set example_key example_value 300
wp cache get example_key
wp cache flush
  • wp cache type reports the object-cache implementation detected by WP-CLI.
  • wp cache supports shows capabilities exposed by the implementation.
  • wp cache set writes a test value; wp cache get reads it back.
  • To test persistence, set a value, start a new request or a separate WP-CLI process, and read it again. A value that exists only within one process indicates request-scoped behavior or a failed persistent connection.
  • wp cache flush clears cache entries. Run it deliberately, especially on a busy site, because the next requests will regenerate data.

The exact output varies by drop-in. A successful command alone does not prove that every web worker shares the same backend, so repeat checks through the web application and, on a multi-server site, from each host.

Troubleshoot the most common failures

No object-cache.php file appears

The plugin may be inactive, blocked from writing to wp-content, incompatible with the current WordPress version, or unable to complete installation. Check filesystem permissions, the plugin’s status screen and PHP error logs. If another plugin installed a drop-in, deactivate or remove the conflicting integration according to its documented uninstall procedure, then install one supported drop-in.

The backend reports “connection refused” or “not found”

Verify the host, port or Unix socket, service status, firewall rules and PHP extension. Test from the web server, not only from your laptop or an administrative shell. On managed hosting, the hostname supplied for Redis or Memcached may be internal and different from a public DNS name.

Authentication or timeout errors occur

Recheck the password, username, TLS settings and database selection. Keep connection timeouts finite so a cache outage does not stall every request. If the site becomes unstable when the backend is unavailable, use the integration’s documented fallback behavior and resolve the service problem before re-enabling it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Values appear stale after an update

Identify which layer contains the stale response. Flush object cache after changing options, code or data that a plugin caches, and clear page, browser or CDN caches when the stale item is a generated response or static asset. Well-designed plugins invalidate their own keys; a global flush should be an exception, not the routine fix.

Multisite shows inconsistent data

Check whether the drop-in supports WordPress multisite global groups and whether every site uses a unique prefix. A local cache on one web server can produce different results from another server. Confirm the integration’s documented network-activation procedure and test both a site-specific value and a network-wide value.

Performance gets worse

Measure database time, PHP time and cache connection time separately. An undersized backend, excessive serialization, network hops, lock contention or a plugin issuing low-value cache requests can offset the benefit. Temporarily disable the drop-in in a maintenance window, compare the same workload, and inspect logs and resource usage before deciding whether to change backends.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Operating an object cache safely

Plan for misses and restarts

Cache data is disposable. Redis, Memcached, a PHP process restart or a manual flush can remove entries, after which WordPress should regenerate them from the database. Never treat the object cache as the only copy of content, orders, users or configuration; keep normal database backups.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use capacity and eviction policies deliberately

Monitor memory or disk usage, evictions, connection counts, errors and latency. If the backend constantly evicts useful keys, increasing capacity or reducing low-value entries may help. If it fills with oversized values, find the plugin creating them instead of blindly allocating more memory.

Keep invalidation tied to deployments

Document when to flush object cache, page cache and CDN cache separately. Code deployments that change serialized data or cache-key formats may require an object-cache flush. Content edits may require only the keys or page responses affected by that edit.

Test with real request contexts

Test anonymous, logged-in, administrator and API requests where your site supports them. Confirm that private data is not returned under a shared key and that nonce, session and user-specific values are excluded or scoped correctly. Persistent caching increases reuse; it does not remove the need for correct cache-key design by plugins and themes.

Answers to practical setup questions

Do I need Redis?

No. Redis is one common backend, not a WordPress requirement. Memcached, Docket Cache and SQLite Object Cache are alternatives with different hosting, extension, security and operational requirements. Choose the option your host supports reliably and that matches whether you need a shared service across multiple application servers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Is Memcached interchangeable with Redis?

They provide similar key/value caching roles but are different services and require different PHP extensions and drop-ins. Use the backend explicitly supported by your integration; do not point a Redis connector at Memcached or assume settings are portable.

Is WP_CACHE enough?

No. The constant does not create a persistent object cache. You still need a compatible drop-in and a reachable, configured backend.

Can object caching and page caching run together?

Yes. Page caching can avoid running WordPress for cacheable responses, while object caching reduces database work when WordPress does run. Configure exclusions and purge rules so the two layers do not serve stale or private content.

How do I know it is active?

Confirm that wp-content/object-cache.php exists, Site Health identifies a persistent implementation, and WP-CLI reports the expected cache type. Then perform a set-and-read test across separate requests and verify the backend connection from the web server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical decision checklist

  • Does the host provide Redis or Memcached, including the required PHP extension?
  • If not, is a supported PHP- or SQLite-based implementation suitable for this server?
  • Will all web workers and application servers reach the same cache?
  • Does the drop-in document multisite and global-group behavior?
  • Are host, port, credentials, database selection and key salt configured securely?
  • Is the service private, firewalled and authenticated?
  • Does Site Health and WP-CLI show a persistent drop-in rather than only a page-cache feature?
  • Have you tested misses, flushes, restarts, logged-in requests and stale-data recovery?

If the answer to these checks is yes, persistent object caching is enabled as a distinct, verifiable layer rather than assumed from a constant or a generic caching label.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.