How to handle it when some changes happen in specific table records ?
public static function getAirportWithCache($iata_code){
$result = Airports::getDb()->cache(function ($db) use ($iata_code){
$res = Airports::find()
->where(['iata_code' => $iata_code])
->limit(1)
->asArray()
->one();
return $res;
});
return $result;
}
Yii::$app->cache->set('dbCache', $result, 0, null)
– Ives