Search code examples
asp.netpersistence

Keeping data in memory and persisting on Application_Disposed


I'm building a website (for personal use, low load) and instead of using an Access or MySQL database for data storage I'm thinking of having one XML file that I load and parse on Application_Start and then keep in memory (in static objects). The website then do reads and writes against these in-memory objects and I will finally persist all data to the XML file on Application_Disposed.

I'm aware that I'll need to make reading/writing thread-safe, but besides that, does anyone see any problem using this approach?


Solution

  • Yes, I see a big problem: There are a number of reasons to why the whole application might die without you knowing about it, and without your data being saved to that xml file.