We fabricated a Ni/SiO2/Pt resistive random-access memory device referred to as a memristor, which demonstrates both volatile and non-volatile switching. A reversible transition between volatile and non-volatile switching is achieved by applying different current compliances (CCs). Volatile switching was observed when the CC is 50 nA, whereas volatile switching changed to non-volatile switching when the CC is 100 nA. The switching mechanism model can be explained by the formation and rupture of conducting filaments by electrochemical metallization effects, which are vital in resistive switching. We demonstrate a simple pulse measurement method for both switching behaviors. In a single Ni/SiO2/Pt memristor device, short-term memory for volatile switching and a long-term memory synaptic function for non-volatile switching is observed under repeated stimuli. Owing to the distinctive characteristics of the Ni/SiO2/Pt device, the short-term synaptic function, i.e. paired-pulse facilitation and depression for volatile switching, is successfully mimicked by the memristor. These electrical results indicate that the Ni/SiO2/Pt memristor device with synaptic behavior has potential for use in brain-inspired computing systems.