original_string: public function cache($key, $config = 'default')
      {
          if ($key === false) {
              $this->_cache = null;
  
              return $this;
          }
          $this->_cache = new QueryCacher($key, $config);
  
          return $this;
      }
code: public function cache($key, $config = 'default')
      {
          if ($key === false) {
              $this->_cache = null;
  
              return $this;
          }
          $this->_cache = new QueryCacher($key, $config);
  
          return $this;
      }
code_tokens: public function cache ( $ key , $ config = 'default' ) { if ( $ key === false ) { $ this -> _cache = null ; return $ this ; } $ this -> _cache = new QueryCacher ( $ key , $ config ) ; return $ this ; }
docstring: Enable result caching for this query.
  
  If a query has caching enabled, it will do the following when executed:
  
  - Check the cache for $key. If there are results no SQL will be executed.
  Instead the cached results will be returned.
  - When the cached data is stale/missing the result set will be cached as the query
  is executed.
  
  ### Usage
  
  ```
  // Simple string key + config
  $query->cache('my_key', 'db_results');
  
  // Function to generate key.
  $query->cache(function ($q) {
  $key = serialize($q->clause('select'));
  $key .= serialize($q->clause('where'));
  return md5($key);
  });
  
  // Using a pre-built cache engine.
  $query->cache('my_key', $engine);
  
  // Disable caching
  $query->cache(false);
  ```
  
  @param false|string|\Closure $key Either the cache key or a function to generate the cache key.
  When using a function, this query instance will be supplied as an argument.
  @param string|\Cake\Cache\CacheEngine $config Either the name of the cache config to use, or
  a cache config instance.
  @return $this
docstring_tokens: Enable result caching for this query .