D
D
droit1742018-02-19 17:53:41
Yii
droit174, 2018-02-19 17:53:41

How to organize the generation of links for an online store?

I am making an online store with a regular directory /catalog /under the directory /under the directory/ product card, it can also be /catalog / product card.
I store all the names of categories and product cards in the database.
in yii2 it parses these links without problems.
but in the createUrl function where the rules for generating links are set,
you will need to contact the database to form links, and if there are 150 links on the page (for example, in the catalog menu), then it will constantly access the database.
how to do it here?
if you use a cache, which one: DB, Files or PHP expansion of memcache and memcached

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-02-19
@webinar

Any cache will do. In yii, caching is essentially separated from the type of cache. So the implementation is the same. It all depends on what is on the server.
But in theory, if a greedy load, then the connections will come with 1 request.

S
Subb98, 2018-02-19
@Subb98

And is it necessary to do so? Why not make links like site.com/stuff_name/...
For example, shop.biz/computers/model123, shop.biz/phones/model472

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question