Disable Yii2 Caching

Is there a way of disabling completely Yii2 cache? I have query results that changes every second but Yii2 for some reasons i don’t understand keeps the old values. Please Help

Can you elaborate a little more details?

Is the problem database caching?

Do you have already loaded cache component?

Can you post here your config file?

By default, the caching won’t occur, because cache component is not loaded by default.

If you enable it in config e.g.:


'cache' => [

    'class' => 'yii\caching\FileCache',

],

then you can fine tune what should be cached, e.g. dont cache database schemas:


'db' => [

    'class' => 'yii\db\Connection',

    'dsn' => 'mysql:host=127.0.0.1;dbname=db_aaabbb',

    'username' => 'root',

    'password' => '**setme**',

    'charset' => 'utf8',

    'enableSchemaCache' => false, // <- disable schema cache

],



Thanks alot this has worked ==> ‘enableSchemaCache’ => false, // <- disable schema cache