All-optical memories based on photonic crystal nanocavities