add cache detection