What is the WordPress Object Cache? As explained here, Object caching involves storing database query results so that the next time a result is needed, it can be served from the cache without having to repeatedly query the database.
There are two pre-made solutions to improve the object cache performance by storing it into memory. One is wp-memcached, the other is Redis Cache.
apt install memcachedapt install php8.0-memcache
After that copy the object-cache.php to your wp-content folder. Done.
Although WordPress doesn’t use native PHP session functionality it still makes sense to set your php.ini session.storage and session.save_path so that other non-Wordpress code on your server can benefit, too.
session.save_handler = memcached session.save_path = "localhost:11211?persistent=1";session.save_path="/tmp/memcached.sock" # if you install memcached on the same server as wordpress, you can and should use the unix socket instead of a tcp connection
apt install redis-server redis-toolsapt install php8.0-redis
Install the plugin with
composer require wpackagist-plugin/redis-cache, deploy your code, enable it.
Then, set your php.ini session.storage and session.save_path:
session.save_handler = redissession.save_path = "tcp://127.0.0.1:6379?persistent=1"; session.save_path = "unix:///var/run/redis.sock" # use the unix socket where possible
And you should be good to go.