Fluid mixing and mass transfer in two-dimensional cavities with time-periodic lid velocity