Improve caching logic on ZooKeeper watches.