R
R
Roman2017-04-14 22:48:42
Yii
Roman, 2017-04-14 22:48:42

In yii2 in foreach calling yii\caching\DbDependency will it be requested every time?

Question if I have foreach and there is for example a static function Test::getExample();
and here getExample writes to the cache and checks yii\caching\DbDependency
Question will this check be called each time the foreach iteration is performed, or will it check once, for example, the number of entries and that's it, and foreach will continue to be executed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-04-16
@webinar

Open debug panel and check. In theory, it will be called every time. And if there is the same request, then it makes sense to take it out of foreach to execute it 1 time. But without code, it's hard to say for sure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question