Is it a good idea to use XML files to present data that is not updated often? VS MYSQL query
I'm building my website and I'd like to limit calls to my MYSQL database.
One idea I have is to use XML files to present information that does not need to be updated as regularly as every page load.
Two example are
Site navigation which might only change once a week.
The number of items in stock which will in most situations only need to be updated when an item becomes out o开发者_高级运维f stock.
I have a feeling this is a good solution, however my experience with XML is quite limited, so I'd like some feedback before delving into it.
Many thanks.
Just use memcache, xcache or any other caching solution to cache your SQL requests.
This might be a good aproach.
Supplying your xml-Files with E-tags forces the Browser to do the caching. So even your Webserver requests could be handled faster.
If you want to use XML for performance reasons, don't do it. Use cache instead, as Märis suggested. If you want to use XML because it is a better primary representation of your model, than by all means, do it ! Be aware that there is a few problems you will have to solve (concurrent edits on your XML files for example).
XML can be a better format to store hierarchical data than a relational database, like your navigation.
精彩评论