Skip to main content

Redis Object Caching

Object caching helps WordPress load dynamic content faster by storing frequently used data in Redis, so WordPress doesn't have to ask the database for the same information again and again.

This is especially useful for pages that cannot be fully page cached, such as:

  • WooCommerce cart, checkout, and account pages

  • WordPress admin screens

  • Logged-in user pages

  • Membership, dashboard, or personalized content pages

What is Object Caching?

When WordPress loads a page, it needs to fetch a lot of data such as:

  • site settings

  • posts and pages

  • post metadata

  • menus

  • categories and tags

  • user information

  • query results

Normally, WordPress gets this data from the database every time a page is loaded.

With object caching enabled, that data is stored in Redis after it is generated once. The next time WordPress needs the same data, it can load it from Redis instead of asking the database again.

This reduces database work and helps dynamic pages load faster.

How it works

Imagine your homepage needs the site settings, navigation menu, recent posts, and a list of WooCommerce products.

Without object caching:

  • WordPress fetches that data from MySQL on every request.

With object caching:

  • First request: WordPress builds the page data and stores it in Redis

  • Next requests: WordPress reuses that cached data from Redis

This means WordPress has to do less work on future requests, which can improve performance and reduce database load.

Benefits

  • Reduce repeated MySQL queries

  • Improve dynamic page performance

  • Reduce CPU usage

  • Speed up logged-in and uncached requests

  • Reduce load on high-traffic sites

Requirements

FlyingPress Object Cache requires:

  • A WordPress site running FlyingPress

  • A Redis server accessible by your site

  • The PHP phpredis extension installed

  • Permission to write the object-cache.php drop-in to wp-content

Before enabling Object Cache, make sure Redis is installed and reachable from your server.

When to use it?

  • You want to speed up the WordPress admin area

  • Your site has dynamic, uncached content (e.g., user dashboards, cart pages)

How to Enable Object Cache

  1. Go to FlyingPress → Caching → Object Caching

  2. Enable Object Cache

  3. If Redis is connected successfully, cache metrics and memory usage will start appear in the FlyingPress dashboard

If Redis connection is failed or anything goes wrong, then you'll see an error in the dashboard.

Drop-in object-cache.php

FlyingPress installs a WordPress object-cache.php drop-in in wp-content folder that intercepts WordPress object cache operations and stores persistent cache data in Redis.

Purging the Object Cache

You can purge the object cache from FlyingPress dashboard when needed. Purging the cache removes stored Redis objects so they can be rebuilt on the next request. This is useful when:

  • Testing changes

  • Troubleshooting stale data

  • Verifying cache behavior

  • Resetting cache state after a migration or environment change

After a purge, the first request to a page will be slower because the cache has to be re-build.

Cache Metrics

FlyingPress Object Cache includes cache metrics for last one hour so you can monitor how Redis is being used over time.

FlyingPress will show following metrics:

  • Cache hit ratio - Shows how often WordPress finds the requested data in Redis instead of rebuilding it.

  • Redis memory usage - Shows how much memory Redis is using to store cached objects.

These metrics help you understand whether your site is benefiting from object caching and whether the cache is being used effectively.

Configuration

In most cases, FlyingPress will connect to Redis automatically as soon as you enable Object Caching, provided Redis is available on your server.

However, some hosting providers use custom Redis connection details (for example, a different host, port, password, database, or Unix socket). In those cases, you’ll need to get the correct Redis configuration from your hosting provider and add the required constants to your wp-config.php file so FlyingPress can connect properly.

Constant

Purpose

Default

WP_REDIS_HOST

Redis host / server address

127.0.0.1

WP_REDIS_PORT

Redis port

6379

WP_REDIS_TIMEOUT

Connection timeout in seconds

1.0

WP_REDIS_USERNAME

Redis username

''

WP_REDIS_PASSWORD

Redis password

''

WP_REDIS_DATABASE

Redis database index to select

0

WP_REDIS_SCHEME

Connection type: tcp or unix

tcp

WP_REDIS_PATH

Unix socket path when using unix scheme

''

WP_REDIS_PREFIX

Key prefix for cache keys

flying-press_

Make sure any these constants are added before this line:

/* That's all, stop editing! Happy publishing. */ require_once(ABSPATH . 'wp-settings.php');

FAQs

Does Object Cache replace page caching?

No. Object caching and page caching are different layers. Page caching stores final HTML, while object caching stores WordPress data and database query results.

Do I need Redis for FlyingPress Object Cache?

Yes. If Redis is not already available you can ask your hosting provider to install it on the server where your site is currently hosted.

Does object caching help WooCommerce?

Yes. Object caching can improve WooCommerce performance, especially on cart, checkout, My Account, logged-in user pages, etc.

Why is the first request slower after enabling object cache?

Because the cache is empty and needs to be populated. Later requests are a better measure of object cache performance.

Can I use another object cache plugin at the same time?

No. Only one object-cache.php drop-in can be active at a time. Running multiple object cache drop-ins together will cause conflicts.

Did this answer your question?