The best server-side data storage method for simple data

I am coding a website that includes storing very simple data, just a very long list of names without any additional data on the server. Since this data is so simple, I really don't want to use MySQL (it would be too awkward), so I ask what is the best way to store very simple data on the server.

I would definitely prefer speed over anything else, and easy access to data via javascript and AJAX would be very good, as the rest of the site was encoded in javascript / jQuery. I do not care if the data can be freely viewed (since it will be available in any case) if it cannot be changed by unauthorized users.

+7
javascript database ajax
source share
3 answers

Use an XML file available on the Internet. You can then request the XML file from the browser, if necessary, and still parse / write it to PHP. You want to use the flock function in PHP to make sure that two instances of the page are not trying to write to the file at the same time.

+3
source share

There is a lot to think about.

  • Is the information the same for all users with only one set that applies to all users? Or is there a separate data set for each user?
  • As the data will be transferred to the client, I assume that you will have a web service or otherwise that may return JSON.
  • From a security point of view, do you want someone to just β€œcapture” data and run it?

Personally, I believe that a database, if often the best choice, but otherwise I would use an XML file. Keep in mind that you need to be careful when loading / reading XML files to serve web requests to prevent any potential file blocking problems.

+5
source share

Write it to a file and save the data as a serialized object. Thus, when you read the data, it is instantly available in the form of the required variable type (array, obj, etc.). This will be faster than XML parsing.

+2
source share

All Articles