  Ideal photonic quantum memories can store arbitrary pulses of light with unit
efficiency. This requires operating in the adiabatic regime, where pulses have
a duration much longer than the bandwidth of the memory. In the non-adiabatic
regime of short pulses, memories are therefore imperfect, and information is
always lost. We theoretically investigate the bandwidth limitations for setups
based on individual atoms, or ensembles thereof, confined inside optical
cavities. We identify an effective strategy for optimizing the efficiencies of
the storage and retrieval process regardless of the duration of the pulses. Our
protocol is derived almost completely analytically and attains efficiencies
better than or comparable to those obtained by numerical optimization.
Furthermore, our results provide an improved understanding of the performance
of quantum memories in several regimes. When considering pulses defined on an
infinite time interval, the shapes can be divided into two categories,
depending on their asymptotic behaviours. If the intensity of the pulse
increases with time slower than or as an exponential function, then the storage
efficiency is only limited by the pulse width. For pulses defined on a finite
interval, on the other hand, the efficiency is determined by the shape at the
beginning of the storage or, correspondingly, at the end of the retrieval
process.
