$cacheDuration = 60; // 1 min
$country_id = Country::getDb()->cache(function ($db) {
return Country::find()->select('id')->asArray()->where(['name' => $matches[1]])->limit(1)->scalar();
}, $cacheDuration);
@frontend - frontend web application directory.
@backend - backend web application directory.