Optical memories implemented with photorefractive media