yii2 clear schema cache

To clear the schema cache in Yii2, you can use the following code:


This code will refresh the schema cache and update it with the latest changes in your database schema. It can be useful when you have made changes to your database structure and want to ensure that the application reflects those changes.

You can place this code in a controller action or anywhere else in your Yii2 application where you want to clear the schema cache. After executing this code, the schema cache will be cleared, and the application will start using the updated schema.

Note that this code assumes you are using the default cache component in Yii2. If you have configured a different cache component, make sure to replace \Yii::$app->cache with the appropriate cache component.

I hope this helps!