CacheBehavior::beforeFind PHP Method

beforeFind() public method

If $queryData['cacher'] is true, it will cache based on the setup settings If $queryData['cacher'] is a duration, it will cache using the setup settings and the new duration.
public beforeFind ( Model $Model, array $queryData )
$Model Model The calling model
$queryData array The query
    public function beforeFind(Model $Model, $queryData)
    {
        if (Configure::read('Cache.disable') === true) {
            return $queryData;
        }
        $this->cacheResults = false || $this->settings[$Model->alias]['auto'];
        if (isset($queryData['cacher'])) {
            if (is_string($queryData['cacher'])) {
                Cache::config($this->settings[$Model->alias]['config'], array('duration' => $queryData['cacher']));
                $this->cacheResults = true;
            } else {
                $this->cacheResults = (bool) $queryData['cacher'];
            }
            unset($queryData['cacher']);
        }
        if ($this->cacheResults) {
            $Model->setDataSource('cacher');
        }
        return $queryData;
    }