title: Yii2 redis cache over file cache
body: <p>I am using a yii2 with file cache and redis cache also. In my main config file redis cache settings are defined.</p>
  
  <pre><code>'redis' =&gt; [
          'class' =&gt; 'yii\redis\Connection',
          'hostname' =&gt; 'MY_IP',
          'port' =&gt; MY_PORT,
          'database' =&gt; 0,
      ],
  </code></pre>
  
  <p>I also added a component under file cache setting.</p>
  
  <pre><code>'cache' =&gt; [
          'class' =&gt; 'yii\caching\FileCache',
      ],
  </code></pre>
  
  <p>so for a caching i'm using a <code>$cache = Yii::$app-&gt;cache;</code> and for setting a cache <code>Yii::$app-&gt;cache-&gt;set($id, $value, $time);</code>  and get using <code>Yii::$app-&gt;cache-&gt;get($id);</code>  so is this is set the value from file cache or it is override the filecache and using the redis over it.</p>
  
  <p>If this is using the filecache so how we override the filecache with redis .Can we use the redis cache with this <code>Yii::$app-&gt;cache-&gt;get($id);</code> or we can use the redis with the <code>use yii\redis\Cache;</code> and set using the </p>
  
  <pre><code>$redis-&gt;hmset('test_collection', 'key1', 'val1', 'key2', 'val2');
  </code></pre>