1. A memristor, comprising: a stack of four functional elements including, in sequence: a first electrode; a barrier layer; an oxygen-deficient switching layer; and a second electrode, wherein the oxygen-deficient switching layer is disposed between the barrier layer and the second electrode without any intervening layers.