Permanent storing of variables for safety

I’m fairly new to elixir/erlang, and I’m wondering what the best way of storing data (In this case integer values) in case of a crash/power shortage. I only want to be able to restore the last registered integer. Are there any nice built-in solutions for this, or do I have to write it to file?

(If that is the case, what is the best way of file I/O-ing integer values with timestamps?)

Dets and/or mnesia is the general built in way for that.