1
I’m building a cakephp and mysql application, and would like to display some menus and items dynamically through the database.
Better example: Display latest updates, latest entries in the database, menu with categories registered in the system, etc.
What happens:
-User accesses home, system requests menus from bank.
-User enters some link, and the system requests again to the database.
I understand that this way, every get on the site, it will in the database again, fetch this information to render the menus.
Doubt:
- Is there any way to adjust so that the system only creates a request in the database in the user access, not overloading the database with selects to each link within the site?
- Changing these requests to ajax would be a good solution?
- Cakephp’s Cachehelper can help with this in some way?
Why, are these access to the bank causing slowness? And yes, caching with Cake mechanisms can be a good solution.
– bfavaretto
It’s actually not running yet, but in my modeling, I realized that with every get this would happen, I would re-order the menus and contents for the bank. This is normal practice?
– Marcelo Aymone
I think this is common, but my focus is another: don’t worry about performance problems that don’t exist yet, IE, don’t waste time with premature optimizations.
– bfavaretto
I don’t know Cake but I would think about doing so: Create a self-referenced table, make a single select, mount the menu
– Bruno Rozendo
This solution served me in this and another question: http://answall.com/questions/21154/passar-vari%C3%A1veis-do-appcontroller-para-Elements-no-cakephp
– Marcelo Aymone