1) пытаюсь кешировать запросы по документации. Написал вначале вот так:
Код: Выделить всё
$item = Menu::getDb()->cache(function($db) use($url) {
return Menu::find()->where(['display_url' => '/'.$url, 'is_hidden' => 0])->one();
});
Код: Выделить всё
$item = Menu::getDb()->cache(function($db) use($url) {
return Menu::find()->where(['display_url' => '/'.$url, 'is_hidden' => 0])->one();
}, 10);
2) как собственно сбросить кеш запросов? Если делать как документации
Код: Выделить всё
yii\caching\Cache::flush()
Код: Выделить всё
Non-static method yii\caching\Cache::flush() should not be called statically, assuming $this from incompatible context