lock cache as necessary