more robust way to cache ssh configs and optimize operations