adds check in cache DFS