There is much on this topic, this is just one solution.
W3 Total Cache is a well known performance plugin for WordPress, and it can use memcached.
memcached should already be listening on loopback, not on a public ip!, on a tcp socket:
root@www:~# netstat -lnp --tcp |head -3
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 681/memcached
Going to need the php extension to connect to the memcached server:
apt install php8.2-memcached
After which, the main things in W3TC we are looking for are object cache (php), page cache, and database cache and all three are working so we are all set.