Originally posted by Aaron John:
Ah okay, that is a good approach. Thanks for that. How often would one read the database in order to have the latest records in memory?
I believe you can assume that there is only one server which uses the data file at any time, so just reading the file in memory at startup of the server would be enough.
I have not implemented this approach entirely in my application, because I still have to find a way to make sure we save the data in memory back to the file. We should do this when the server is being shutdown, but we should also make sure we do not lose to much data when the server crashes. Perhaps saving the data file every x seconds / minutes is a good approach here?