How to flush db query cache ?

How to flush db query cache ?

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;

    }



You can use dependencies and set duration as stated in Query Caching Usages.

Flush info