update cache checking logic