Every time WordPress builds a page it talks to MySQL: options, menus, posts, user data and values stored by plugins all come from the database. On a small blog you will not notice, but a large shop or the admin dashboard can easily run hundreds of queries per page. An object cache exists to cut down these repeated lookups. Instead of storing finished HTML, it keeps individual pieces of data fetched from the database in memory.
How the built-in object cache works
WordPress core ships with the WP_Object_Cache class, and it is always active. The catch is that it lives only for a single request: once the page is rendered, everything is discarded and the next visitor triggers the same queries again. It removes duplicates within one page but keeps nothing between requests.
A persistent object cache fills that gap. A special drop-in file, object-cache.php, is placed in wp-content, and WordPress routes its cache calls to an external store. Redis is the most common choice: it keeps data in RAM and responds very quickly, so a value read from the database once can be served to later visitors straight from Redis.
Which sites actually benefit
If a site is mostly static and already uses full-page caching, anonymous visitors will see little difference because they receive ready-made HTML and PHP never runs. Redis pays off where page caching is bypassed: the admin area, logged-in users, cart and checkout, search results and complex filters.
Picture a Tashkent electronics store on WooCommerce with more than five thousand products. Managers update prices daily and shoppers rely on category filters. The product list in the dashboard loads slowly because metadata and taxonomies are rebuilt from the database each time. With Redis, most of those repeated queries are answered from memory and the dashboard becomes noticeably faster. The exact gain depends on your plugins and data, so measure before and after.
Installing Redis on a VPS
On Ubuntu or Debian, Redis and the PHP extension come from the official repositories:
sudo apt update
sudo apt install redis-server php-redis
sudo systemctl enable --now redis-server
redis-cli ping
A PONG reply means the server is up. Restart PHP-FPM afterwards so it loads the new module, for example sudo systemctl restart php8.3-fpm. To keep Redis from growing without bounds, set a limit and an eviction policy in /etc/redis/redis.conf:
maxmemory 256mb
maxmemory-policy allkeys-lru
With allkeys-lru, the least recently used keys are evicted when memory is full, which is fine for a cache because everything can be rebuilt from the database. Size the limit with MySQL and PHP-FPM in mind, then restart Redis.
Connecting WordPress
The usual route is the Redis Object Cache plugin, which installs the drop-in and shows the connection status. Define the basics in wp-config.php first, especially when several sites share one server:
define( 'WP_REDIS_HOST', '127.0.0.1' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_DATABASE', 0 );
define( 'WP_REDIS_PREFIX', 'example_uz_' );
The prefix keeps each site's keys separate. With WP-CLI you can do the rest from the shell:
wp plugin install redis-cache --activate
wp redis enable
wp redis status
Checking that it works
Compare cache hits and misses:
redis-cli info stats | grep -E 'keyspace_hits|keyspace_misses'
After the site has been running for a while, hits should clearly outnumber misses. If not, keys may be evicted too quickly. A diagnostic plugin such as Query Monitor, enabled temporarily, shows the query count per page so you can compare the same page before and after.
Common pitfalls
Stale data is the first one: some plugins write to the database directly without updating the cache, so old values linger. Flushing with wp cache flush helps, but find the plugin responsible. Second, if Redis stops while the drop-in is still in place, the site may error out or slow down, so monitor the service and make sure it starts on boot. Third, keep Redis bound to 127.0.0.1 and never expose its port to the internet.
On shared hosting you cannot install Redis yourself; ask through the sayt.uz cabinet or support whether your plan offers a persistent cache. When a growing site needs object caching and full control, a VPS is the logical next step.