Artificial intelligence is widely used in everyday life. However, an insufficient computing efficiency due to the so-called von Neumann bottleneck cannot satisfy the demand for real-time processing of rapidly growing data. Memristive in-memory computing is a promising candidate for highly efficient data processing. However, performance of memristors varies significantly because of microstructure change induced by electric-driven matter migration. Here, we propose an all-optically controlled (AOC) memristor with a simple Au/ZnO/Pt sandwich structure based on a purely electronic tuning mechanism of memconductance. The memconductance can be reversibly tuned only by light irradiation with different wavelengths. The device can be used to perform in-memory computation such as nonvolatile neuromorphic computing and Boolean logic functions. Moreover, no microstructure change is involved during the operation of our AOC memristor which demonstrates superior operation stability. Based on this and its structural simplicity, the device has attractive application prospects for the next generation of computing systems.