In-memory computing based on all-optically controlled memristor