title: How can I disable caching via configuration in Yii?
body: <p>In Yii, I have enabled APC caching through the config/main.php file:</p>
  
  <pre><code>'cache' =&gt; array(
      'class' =&gt; 'system.caching.CApcCache',
  ),
  </code></pre>
  
  <p>and it works just fine when I use Yii's built-in caching methods:</p>
  
  <pre><code>Yii::app()-&gt;cache-&gt;set('key', $value);
  </code></pre>
  
  <p>However, is there a way to temporarily turn this off based on configuration?  I don't want to have it enabled while <code>YII_DEBUG</code> is set to true, for example, and would like <code>$votes = Yii::app()-&gt;cache-&gt;get("key");</code> to <em>always</em> return false as it does when it's empty.</p>
  
  <p>I've tried turning this off by just commenting-out the configuration setting, but it gives (not unreasonable) errors:  <code>Call to a member function get() on a non-object</code></p>