Implemented caching for connections.