improve cache method