High-speed quantum memory for photons