Does your hosting have sql server problems all the time or from time to time? Do you lose data because of sql server issues? If yes then this post may be good case for you.
I use my own technique to backup critical data to HDD.
If there is any sql server issue then my code does backup of critical data to HDD and then restores that data from HDD when sql server back and running well.
Sure, just storing data into file(s) on hdd is really not good case (or even worse). You will need a lot of code to handle concurrency, navigation, select and find data, ordering and much more, and it is the place where LiteDB comes in to scene.
So my logic is simple:
- is there an exception while saving data into SQL Database?
- take that data and store it into LiteDB
- create a scheduled task to check if SQL Server issue has gone and do insert/update your SQL Database
- successfully inserted/updated? remove the data from LiteDB otherwise keep trying until success.
LiteDB uses single HDD file to store data and provides SQL-like functionality to operate your data.
Really simple and useful technique to avoid losing critical and important data. Also I show notification to related user that there are some pending data so users would not be disappointed.
Thank you :)