Blog, News & Events

How to Enable Redis or Memcached for Faster WordPress

Website speed is one of the most critical factors for user experience, SEO ranking, and conversion rates. If your WordPress site feels sluggish, enabling server-side caching with Redis or Memcached can drastically improve performance.

In this guide, we’ll walk you through how to enable Redis or Memcached for your WordPress site — especially when hosted on Sternhost VPS, which fully supports both caching technologies.

What Are Redis and Memcached?

Both Redis and Memcached are in-memory caching systems that temporarily store frequently accessed data, reducing the load on your database and improving page load speeds.

Feature Redis Memcached
Data Type Support Strings, Lists, Hashes, Sets Strings only
Persistence Yes No
Performance Slightly slower but more powerful Extremely fast but simple
Use Case Complex apps, sessions, and caching Simple page and query caching

For most WordPress users, either Redis or Memcached can dramatically speed up database-driven pages.

Step 1: Install Redis or Memcached on Sternhost VPS

If you’re using Sternhost VPS, installing Redis or Memcached is simple. Connect via SSH and run the following commands depending on your choice:

For Redis:

sudo apt update
sudo apt install redis-server -y
sudo systemctl enable redis-server
sudo systemctl start redis-server

For Memcached:

sudo apt update
sudo apt install memcached -y
sudo systemctl enable memcached
sudo systemctl start memcached

Confirm they are running:

sudo systemctl status redis-server
sudo systemctl status memcached

Step 2: Install PHP Extensions

Your WordPress needs PHP support for the chosen caching system.

For Redis:

sudo apt install php-redis -y

For Memcached:

sudo apt install php-memcached -y

Restart your web server:

sudo systemctl restart apache2
# or
sudo systemctl restart nginx

Step 3: Configure WordPress to Use Redis or Memcached

Option 1: Using a Plugin (Recommended)

You can use one of the following plugins:

  • For Redis:

    • Plugin: Redis Object Cache

    • Install via WordPress → Plugins → Add New → Search “Redis Object Cache”

    • Activate and click Enable Object Cache

  • For Memcached:

    • Plugin: W3 Total Cache or LiteSpeed Cache (if on LiteSpeed)

    • Go to Performance → General Settings

    • Enable Memcached under Object Cache or Database Cache

Option 2: Manual Configuration (Advanced)

For Redis, edit your wp-config.php and add:

define('WP_CACHE_KEY_SALT', 'yourdomain.com');
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);

For Memcached:

define('WP_CACHE', true);

Then restart your web server.

Step 4: Verify the Cache is Working

Once enabled, test your cache with these commands:

For Redis:

redis-cli monitor

For Memcached:

echo "stats settings" | nc localhost 11211

Alternatively, check plugin dashboards for cache hit/miss ratios.

Step 5: Benchmark Your Site

You can verify performance improvements using tools like:

You’ll likely notice faster TTFB (Time to First Byte) and reduced server response time after enabling caching.

Benefits of Using Redis or Memcached on Sternhost VPS

  • 🚀 Faster Page Loads: Reduces database queries.

  • 💾 Lower Resource Usage: Frees up CPU and RAM for other tasks.

  • 🔒 Better Scalability: Handles more traffic efficiently.

  • 🔁 Improved Uptime: Reduces server stress during traffic spikes.

With Sternhost’s high-performance VPS, Redis and Memcached can operate at peak efficiency — giving your WordPress site a significant performance edge.

Redis and Memcached are powerful caching solutions that can make your WordPress website load in milliseconds instead of seconds. Whether you prefer Redis’s advanced capabilities or Memcached’s simplicity, both can transform your website’s speed when combined with Sternhost’s VPS hosting.

👉 Start optimizing your WordPress performance today with Sternhost VPS Hosting — built for speed, reliability, and scalability.

Leave a Reply

Your email address will not be published.