src/PartialCache.php
public function cache($data, $view, $mergeData = null, $minutes = null, $key = null, $tag = null)
    {
        if (! $this->enabled) {
            return call_user_func($this->renderView($view, $data, $mergeData));
        }

        $viewKey = $this->getCacheKeyForView($view, $key);

        $mergeData = $mergeData ?: [];

        $tags = $this->getTags($tag);

        $minutes = $this->resolveCacheDuration($minutes);

        if ($this->cacheIsTaggable && $minutes === null) {
            return $this->cache
                ->tags($tags)
                ->rememberForever($viewKey, $this->renderView($view, $data, $mergeData));
        }

        if ($this->cacheIsTaggable) {
            return $this->cache
                ->tags($tags)
                ->remember($viewKey, $minutes, $this->renderView($view, $data, $mergeData));
        }

        if ($minutes === null) {
            return $this->cache
                ->rememberForever($viewKey, $this->renderView($view, $data, $mergeData));
        }

        return $this->cache
            ->remember($viewKey, $minutes, $this->renderView($view, $data, $mergeData));
    }
public function cache($data, $view, $mergeData = null, $minutes = null, $key = null, $tag = null)
    {
        if (! $this->enabled) {
            return call_user_func($this->renderView($view, $data, $mergeData));
        }

        $viewKey = $this->getCacheKeyForView($view, $key);

        $mergeData = $mergeData ?: [];

        $tags = $this->getTags($tag);

        $minutes = $this->resolveCacheDuration($minutes);

        if ($this->cacheIsTaggable && $minutes === null) {
            return $this->cache
                ->tags($tags)
                ->rememberForever($viewKey, $this->renderView($view, $data, $mergeData));
        }

        if ($this->cacheIsTaggable) {
            return $this->cache
                ->tags($tags)
                ->remember($viewKey, $minutes, $this->renderView($view, $data, $mergeData));
        }

        if ($minutes === null) {
            return $this->cache
                ->rememberForever($viewKey, $this->renderView($view, $data, $mergeData));
        }

        return $this->cache
            ->remember($viewKey, $minutes, $this->renderView($view, $data, $mergeData));
    }
public function cache ( $ data , $ view , $ mergeData = null , $ minutes = null , $ key = null , $ tag = null ) { if ( ! $ this -> enabled ) { return call_user_func ( $ this -> renderView ( $ view , $ data , $ mergeData ) ) ; } $ viewKey = $ this -> getCacheKeyForView ( $ view , $ key ) ; $ mergeData = $ mergeData ? : [ ] ; $ tags = $ this -> getTags ( $ tag ) ; $ minutes = $ this -> resolveCacheDuration ( $ minutes ) ; if ( $ this -> cacheIsTaggable && $ minutes === null ) { return $ this -> cache -> tags ( $ tags ) -> rememberForever ( $ viewKey , $ this -> renderView ( $ view , $ data , $ mergeData ) ) ; } if ( $ this -> cacheIsTaggable ) { return $ this -> cache -> tags ( $ tags ) -> remember ( $ viewKey , $ minutes , $ this -> renderView ( $ view , $ data , $ mergeData ) ) ; } if ( $ minutes === null ) { return $ this -> cache -> rememberForever ( $ viewKey , $ this -> renderView ( $ view , $ data , $ mergeData ) ) ; } return $ this -> cache -> remember ( $ viewKey , $ minutes , $ this -> renderView ( $ view , $ data , $ mergeData ) ) ; }
Cache a view. If minutes are null, the view is cached forever.

@param array        $data
@param string       $view
@param array        $mergeData
@param int          $minutes
@param string       $key
@param string|array $tag

@return string
Cache a view . If minutes are null the view is cached forever .