If you accidentally add a space at the end of the server name in the Redis config, Moodle doesn't care. It works fine. I assume it must trim the hostname.
However, this breaks moodle-tool_redis with a DNS resolution error.
Please consider adding a trim() to be consistent.