public function cache($duration = true, $dependency = null)
    {
        $this->queryCacheDuration = $duration;
        $this->queryCacheDependency = $dependency;
        return $this;
    }
public function cache($duration = true, $dependency = null)
    {
        $this->queryCacheDuration = $duration;
        $this->queryCacheDependency = $dependency;
        return $this;
    }
public function cache ( $ duration = true , $ dependency = null ) { $ this -> queryCacheDuration = $ duration ; $ this -> queryCacheDependency = $ dependency ; return $ this ; }
Enables query cache for this Query.
@param int|true $duration the number of seconds that query results can remain valid in cache.
Use 0 to indicate that the cached data will never expire.
Use a negative number to indicate that query cache should not be used.
Use boolean `true` to indicate that [[Connection::queryCacheDuration]] should be used.
Defaults to `true`.
@param \yii\caching\Dependency $dependency the cache dependency associated with the cached result.
@return $this the Query object itself
@since 2.0.14
Enables query cache for this Query .