etrader Posted August 29, 2011 Share Posted August 29, 2011 Where is the best to store the list of categories and menu? Obviously it is better to reduce mysql queries. From a plain list in file, we can create desirable list (menu) from an array. This is quite faster (though SELECT from an indexed table is fast too; but I do know if it is as fast as reading from a php file). Any idea how to code this to create the menu faster ? Link to comment https://forums.phpfreaks.com/topic/245939-reading-a-menu-from-database-or-file/ Share on other sites More sharing options...
gizmola Posted August 29, 2011 Share Posted August 29, 2011 What is important is not which is faster, but what are the requirements for menus. Is it a requirement that a user should be able to go into an admin system and add/change/delete menus? If so, then you are better off storing them in a database. You can then cache the results in a variety of ways. Changing the menu would need to invalidate the cache. Even without caching, if your database server had plenty of memory and your database contents could be kept in the database cache, it would always be extremely fast. However, if you rarely change the menu, or the menu will be changed only by developers, then you are better off with a code based menu. Link to comment https://forums.phpfreaks.com/topic/245939-reading-a-menu-from-database-or-file/#findComment-1263077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.