How to Set Up Redis Caching
Install and configure Redis object caching on your GoZen Host VPS for faster WordPress, Joomla, and custom application performance.
Redis is an in-memory data store that caches frequently accessed data (database queries, session data, page fragments) in RAM instead of hitting the disk every time. For WordPress, Redis can reduce database queries by 50-80%, making your site noticeably faster.
Is Redis Available on My Plan?
| Plan Type | Redis Available? |
|---|---|
| Shared hosting | No (use LiteSpeed Cache instead) |
| Managed VPS | Yes (may need activation) |
| Dedicated VPS | Yes (install it yourself) |
| Cloud hosting (Enhance) | Depends on server configuration |
Install Redis on a VPS
Ubuntu/Debian
sudo apt update
sudo apt install -y redis-server
Configure Redis
sudo nano /etc/redis/redis.conf
Key settings to change:
# Bind to localhost only (security)
bind 127.0.0.1
# Set a memory limit (256MB is a good start)
maxmemory 256mb
# Eviction policy (remove least recently used keys when full)
maxmemory-policy allkeys-lru
# Run as a background service
daemonize yes
Restart Redis:
sudo systemctl restart redis-server
sudo systemctl enable redis-server
Verify it’s running:
redis-cli ping
# Should respond: PONG
Redis for WordPress
Install the Plugin
- Install Redis Object Cache
- Activate it
- Go to Settings > Redis
- Click Enable Object Cache
The plugin connects to Redis automatically if it’s running on localhost with default settings.
Verify It’s Working
Go to Settings > Redis. You should see:
- Status: Connected
- Client: PhpRedis or Predis
- Hits/Misses: Increasing numbers (more hits = working correctly)
Advanced: wp-config.php Settings
If Redis is on a non-default port or you want to customize:
// Add before "That's all, stop editing!"
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', 6379);
define('WP_REDIS_DATABASE', 0); // Use a different DB index per site
define('WP_REDIS_PREFIX', 'mysite_'); // Prefix for multisite or multiple WP installs
Redis for Multiple WordPress Sites
If you’re running multiple WordPress sites on one VPS, give each site its own Redis database index:
Site 1 (wp-config.php):
define('WP_REDIS_DATABASE', 0);
Site 2 (wp-config.php):
define('WP_REDIS_DATABASE', 1);
Redis supports databases 0-15 by default.
Monitoring Redis
# Check memory usage
redis-cli info memory
# Check connected clients
redis-cli info clients
# Watch commands in real-time
redis-cli monitor
# Check hit/miss ratio
redis-cli info stats | grep keyspace
Key Metrics to Watch
| Metric | Good Value | What It Means |
|---|---|---|
used_memory_human | Under your maxmemory limit | How much RAM Redis is using |
keyspace_hits / misses | High ratio (90%+) | Cache effectiveness |
connected_clients | Under 100 | Number of active connections |
evicted_keys | Low or zero | Keys removed due to memory pressure |
Troubleshooting
| Problem | Fix |
|---|---|
| Plugin shows “Not connected” | Check Redis is running: sudo systemctl status redis-server |
| Redis running but plugin can’t connect | Install the PhpRedis extension: sudo apt install php-redis then restart PHP |
| High memory usage | Lower maxmemory or check for bloated transients in WordPress |
| Redis crashes under load | Increase maxmemory or check system RAM with free -h |
Redis vs Memcached
Both are in-memory caching systems. For WordPress:
| Feature | Redis | Memcached |
|---|---|---|
| Data persistence | Yes (survives restart) | No |
| Data structures | Strings, lists, sets, hashes | Strings only |
| WordPress plugin support | Better (more popular) | Good |
| Multi-database | Yes (0-15) | No |
| Recommendation | Use this | Only if Redis isn’t available |
Related Articles
Last updated 19 Apr 2026, 23:46 +0300.