Configure Redis Object Cache on Hostinger for Faster WordPress

by Fahim

Every time an uncached visitor hits your WordPress site or you navigate the admin dashboard, your server runs dozens—sometimes hundreds—of database queries for site options, post metadata, and user caps. If your backend feels sluggish despite having a page caching plugin, unoptimized database queries are usually the culprit. We can fix that by offloading repeated queries to an in-memory Redis instance on Hostinger.

Full-page caching (LiteSpeed or Nginx FastCGI) works wonders for logged-out visitors reading static posts, but it completely skips dynamic requests. When you edit a post, manage WooCommerce orders, or run search queries, page caching does nothing. That’s where a persistent object cache actually moves the needle.

Terminal showing Redis monitor queries and object cache connection for WordPress
Terminal showing Redis monitor queries and object cache connection for WordPress

What Redis Actually Caches in WordPress

WordPress includes built-in caching via the WP_Object_Cache class, but by default, it only lives for the lifespan of a single HTTP request. As soon as PHP finishes rendering the response, everything in that cache is thrown away.

Redis fixes this by persisting query results in RAM across requests. When you drop in a Redis object cache provider (object-cache.php), WordPress writes complex query results directly into Redis memory. On subsequent hits—even from different users—WordPress pulls the data from RAM instead of querying MySQL again.

  • Autoloaded options (active plugins, site settings, widget configs) load straight from memory on every request.
  • Post and taxonomy relationships bypass expensive SQL joins across tables like wp_posts and wp_term_relationships.
  • Admin dashboard TTFB frequently drops from 800ms+ down to 150–250ms on plugin-heavy installs.

Prerequisites and Plan Requirements

Hostinger locks Redis behind specific hosting tiers. Before editing configs, verify your setup:

  1. A Hostinger Business Web Hosting, Cloud Hosting, or VPS plan (Single and Premium shared tiers do not support Redis).
  2. PHP 8.1+ with the php-redis extension enabled.
  3. SSH access enabled in hPanel for running WP-CLI commands and monitoring keys.

If you’re running this on an active production store, I strongly suggest you set up a WordPress staging site in Hostinger hPanel first so you don’t break active checkout sessions.

Step 1: Enable Redis in Hostinger hPanel

Hostinger lets you turn on Redis directly from hPanel, but you need to enable both the server daemon and the PHP extension.

  1. Log in to hPanel.
  2. Go to Websites, find your domain, and click Manage.
  3. In the left sidebar, navigate to Advanced > PHP Configuration.
  4. Switch to the PHP Extensions tab, locate redis, check the box, and click Save.
  5. Next, head to WordPress > Security / Performance (or search for “Redis” in the top search bar) and toggle Redis to Enabled.

Hostinger instances bind Redis either to local TCP (127.0.0.1:6379) or a Unix socket depending on the server cluster. Most modern hPanel setups use standard TCP loopback.

Step 2: Add Cache Keys and Salting to wp-config.php

Never activate an object cache plugin without adding a unique salt. If you host staging environments or multiple sites on the same server, they will share the Redis instance and overwrite each other’s keys unless you isolate them.

Open wp-config.php via SSH, SFTP, or the hPanel File Manager, and paste these constants above the /* That's all, stop editing! Happy publishing. */ line:

// Redis Object Cache Configuration
define( 'WP_REDIS_SCHEME', 'tcp' );
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_TIMEOUT', 1 );
define( 'WP_REDIS_READ_TIMEOUT', 1 ); // Unique salt to prevent collision across multiple sites on same server
define( 'WP_CACHE_KEY_SALT', 'mysite_prod_' ); // Keep cache lifetime reasonable (e.g., 7 days in seconds)
define( 'WP_REDIS_MAXTTL', 604800 );

The 1-second timeout is critical: if the Redis daemon ever crashes or restarts, PHP workers will gracefully fall back to MySQL rather than hanging for 30 seconds and throwing 504 Gateway Timeouts.

Step 3: Install and Connect the Redis Object Cache Plugin

While several plugins provide Redis drop-ins, Till Krüss’s Redis Object Cache is the most reliable and well-maintained option for PHP 8.x.

I usually install and enable it over SSH using WP-CLI:

# Navigate to your WordPress root directory
cd ~/public_html # Install and activate the plugin
wp plugin install redis-cache --activate # Enable the Redis drop-in
wp redis enable

Running wp redis enable copies the plugin’s object-cache.php drop-in straight into your wp-content/ directory. You should see Success: Object cache enabled. in your terminal.

Prefer the GUI? Go to Settings > Redis in your WordPress dashboard and click Enable Object Cache. You’ll see a green “Connected” status along with your Redis server version and memory metrics.

Step 4: Verify Cache Hits and Check Redis Memory

Don’t just trust a green status badge in the admin panel. Make sure keys are actually populating in memory.

First, test basic functionality from the terminal:

# Check the status and live metrics
wp redis status # Fetch a specific cached group
wp cache get alloptions options

If you have CLI access with the Redis binary installed, you can stream commands in real time:

redis-cli monitor

Open your site in an incognito window and load a few pages. You should immediately see a flood of GET and SET operations in your terminal:

1711928340.102341 [0 127.0.0.1:48292] "GET" "mysite_prod_options:alloptions"
1711928340.104521 [0 127.0.0.1:48292] "GET" "mysite_prod_posts:142"
1711928340.105128 [0 127.0.0.1:48292] "GET" "mysite_prod_post_meta:142"

Hit Ctrl + C to exit the monitor. Before changing cache configurations on live stores, it’s always smart to automate WordPress backups with WP-CLI and cron so you have a quick restore point.

Step 5: Exclude Volatile Groups and Tune Performance

Some data types—like transients, temporary shopping carts, or short-lived auth tokens—should not persist indefinitely in Redis. Caching volatile data can bloat your memory footprint and cause stale state issues.

Tell the drop-in to bypass persistent caching for these specific groups by adding them to wp-config.php:

// Exclude volatile or short-lived transients from Redis
define( 'WP_REDIS_IGNORED_GROUPS', [ 'counts', 'plugins', 'themes', 'wc_session_id',
] ); // Non-persistent groups stay in PHP memory only for single request
define( 'WP_REDIS_NON_PERSISTENT_GROUPS', [ 'comment', 'counts', 'plugins',
] );

On busy sites, you’ll also want background cleanup jobs running on a real server cron rather than relying on visitor traffic. Take a look at our guide on how to replace WordPress WP-Cron with a real cron job in Hostinger hPanel to offload cache expiration tasks from critical page requests.

Debugging Common Connection Failures

If the plugin shows “Disconnected” or triggers fatal errors, here is how to resolve the three most common bottlenecks:

1. The Drop-in File Is Missing or Locked

If WordPress cannot write to wp-content/object-cache.php because of bad file permissions, the cache will fail silently. Verify permissions over SSH:

chmod 644 wp-content/object-cache.php
chown -R $(whoami):$(whoami) wp-content/object-cache.php

2. Port Conflicts or Socket Paths

If connections to 127.0.0.1:6379 get refused, Hostinger might have set your account up with a Unix socket instead of a TCP port. Check if a socket exists in your user directory:

ls -la ~/.redis/

If you find a redis.sock file, update your wp-config.php constants to connect over the socket path:

define( 'WP_REDIS_SCHEME', 'unix' );
define( 'WP_REDIS_PATH', '/home/YOUR_USERNAME/.redis/redis.sock' );

3. Flushing Corrupted or Stale Keys

If the admin panel is acting up or serving stale settings after a major update, flush the Redis database completely:

wp cache flush

For more details on memory limits and eviction behavior, check the official Redis documentation.

Frequently Asked Questions

Does Redis replace LiteSpeed Cache or WP Rocket?

No. Full-page caching plugins generate and serve static HTML pages to logged-out visitors. Redis caches database query objects. They solve two different bottlenecks and work best when used together.

Why is Redis not available on my Hostinger Single/Premium plan?

Redis runs as an in-memory key-value service requiring dedicated RAM allocations. Hostinger only provides it on Business and Cloud tiers to prevent lower-tier shared servers from running out of memory.

How much memory does WordPress need in Redis?

Most WordPress sites with 40–50 active plugins and several thousand posts consume between 20MB and 60MB of Redis RAM. Even heavy WooCommerce stores rarely need more than 256MB for object caching.

Will Redis break WooCommerce cart updates?

No. Modern Redis plugins automatically exclude WooCommerce cart session data and customer fragments from persistent storage, preventing cart mix-ups between users.

Next Steps for WordPress Performance Tuning

With query caching active in RAM, test your response times using WebPageTest or DevTools. Look closely at backend TTFB on dynamic pages like /wp-admin/ and /checkout/.

If you need to move existing databases to a new environment without hitting cache corruption or timeouts, check our guide on how to migrate a large WordPress site to Hostinger with SSH and WP-CLI.

all_in_one_marketing_tool