-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency::$reusable doesn't work resulting in many DB queries #3052
Comments
It's logging regardless getting from db or cache, I think. |
There is dedicated property for customizing that behavior. Check the |
public $reusable = false; |
@githubjeka, have you tried to turn it on and check the result? :-) |
I try ^_^. But there false, obviously the same as it is disabled. |
@githubjeka, yes, and you suggest us to change its default value? |
does not matter $reusable = true or false. i get five logs |
Can you check the following? If it doesn't work it should be a bug. <?php
Yii::$app->db->beginCache(
null,
new \yii\caching\DbDependency(['sql' => 'SELECT MAX(updateAt) FROM sector', 'reusable' => true]));
?>
<?= $piping->getLine() ?>
<?= $piping->getLineOnBalance() ?>
<?= $piping->getLineOffBalance() ?>
<?= $piping->getLineBeforeOffBalance() ?>
<?= $piping->getLineAftereOffBalance() ?>
<?php
Yii::$app->db->endCache();
?> |
i tried - not work |
Looks like |
In if (($result = $cache->get($cacheKey)) !== false) {
Yii::trace('Query result served from cache', 'yii\db\Command::query');
return $result;
} should not be performed repeatedly. Here ( |
@githubjeka it's not query cache level, it's dependency level that should be fixed. |
How to stop him on the second sql: <?= $piping->getLine() ?>
<?= $piping->getLineOnBalance() ?>
<?= $piping->getLineOffBalance() ?>
<?= $piping->getLineBeforeOffBalance() ?>
<?= $piping->getLineAftereOffBalance() ?> |
See #3052 (comment) |
I've renamed the issue. |
@githubjeka Could you update and try again? Thanks. |
* 'master' of github.com:yiisoft/yii2: (79 commits) Refactored app bootstrap logic. Update authorization.md Fixes #3052: Fixed the issue that cache dependency data is not reused when `reusable` is set true start debug logging only if debug runs when bootstrap. Update finnish translation Add ODBC support to yii\db\Connection updated error handler and requirement checker links. fixed broken API links [skip ci] added more doc [skip ci] update class map. Fixes #2034: Added `ContentNegotiator` to support response format and language negotiation renamed attributes to attributeNames in model updated phpdoc Removed `Application::preload` in favor of `Application::bootstrap` Update module-debug.md Update model.md Fixes Update basics.md typo fix [skip ci] Added `HtmlResponseFormatter` and `JsonResponseFormatter` ...
Not work:
if (!$this->reusable) {
return $this->generateDependencyData($cache) !== $this->data; PR not fixed this, it essentially has not changed this section. In short, everything is still. |
But... I delete folder Delete forlder It turns out if you want to reusable , then reusable is |
Revised his views, is all logical. Everything works. Thanks. |
* upstream: (401 commits) Minor refacotring of bootstrap active field and form. support hiding error and label tags via error(false) and label(false). updated base AR phpdoc for findOne() and findAll() fixed wrong example. allow . in input name added not about joinWith background add guide about filtering and sorting related columns Update data-grid.md Issue yiisoft#3029: Implement ActiveForm and ActiveField added docs about gridview filtering typo Update data-overview.md Looks like GridView has its own section... :) Some docs on GridView Bulgarian translation Most trivial edit fixed file PHPdoc Refactored app bootstrap logic. Update authorization.md Fixes yiisoft#3052: Fixed the issue that cache dependency data is not reused when `reusable` is set true ...
in logs
Why repeatedly perform dependent sql?
p.s.
The text was updated successfully, but these errors were encountered: