fix array iterator methods and improve cache retrieval logic