Add cache for SMT queries