S
S
Stancialeta2016-08-10 20:56:05
Java
Stancialeta, 2016-08-10 20:56:05

Where is the best place to store header/footer data?

There is a Spring project. The project has a classic two-level menu (catalog).
On the example of Yandex.Market:
5fbb9b99a2f0442298fdf0a7aab8b8a9.jpg
The project is focused on several cities. The menu is based on the selected city.
Ie in Saratov there may be no root category "Electronics". There will be no sub-categories "TVs" in Tver, etc.

There is a menu on every page of the project. It is logical that doing an sql query when it is rendered on each page of the site is not the best solution.

Where is the best place to store this kind of information after getting it from the database?
There were ideas to store this:

  1. In session.
  2. js file with JSON attached. But here's the thing, I don't have access to the user's file system (obviously, but still). That is, I can write json only to the server of the form:
    - one city, one json with a menu.
    - one json with all categories/subcategories and visibility settings for each city.
    The approach is tough, but it's just an idea.

In addition to the menu, I drag the data of the form from the database: phone number, working hours, and other things that I would like to receive once when a user visits the site.

Perhaps the question is very simple, but I did not find a better solution. Please tell me how you do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evhen, 2016-08-10
@Stancialeta

For example store in Spring Cache

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question