Add DNS caching function.

I add DNS caching function. Please merge it.