Most guides are for the initial setup, so if you are not starting from scratch, YMMV.
This is the one that put me on the right track, but it's for older version of Ubuntu, so it's not exact step-by-step because it's old.
https://bayton.org/docs/nextcloud/installing-nextcloud-on-ubuntu-16-04-lts-with-redis-apcu-ssl-apache/
A more updated guide to the same basic setup, but i've never used it so I can't vouch for whether it is accurate:
https://www.knthost.com/nextcloud/nextcloud-memory-caching-with-apcu-and-redis
(edit: I just checked and it is accurate, but it just hand-waves away the redis setup. which is not insignificant)
Here is the NC docs page.
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html
Note: If you are short on RAM or want the simpler version for home/lan use, you can just set up APCu and get a decent performance boost. I got better performance with both: APCu for file locking along with redis for memcaching. But setting up both will be a bit more complicated to setup and maintain.
Six months ago, I was exactly where you are, but updating host OS, then updating Nextcloud to 27, and setting up memcaching worked great for me. Get everything updated before doing the setup, though, or you'll break shit and have to troubleshoot.