Move lru cache from inside of _encode_host
to outside
#1348
+153
−133
_encode_host
to outside
#1348