Cache, is it useful for redis?
Or you bind it to app.locals, check it, if there is a menu, just get it directly, if not, go to the database to query and bind it.
In this way, you can get it directly every time. Of course, if you update, the menu should also be updated on app.locals.
I don’t know
node
, is it possible to load the menu data when it is started and put the menu data into global variables?Personally, I think you can do a layer of caching.
Split the page and introduce additional ejs subpages.
https://github.com/hubwiz/example-node
You can save it in cache
Cache, is it useful for redis?
Or you bind it to
app.locals
, check it, if there is a menu, just get it directly, if not, go to the database to query and bind it.In this way, you can get it directly every time. Of course, if you update, the menu should also be updated on
app.locals
.