added chained DNS cache class, added tests, some refactoring