Frontend\Modules\Search\Ajax\Livesuggest::getCachedData PHP Method

getCachedData() private method

Load the cached data
private getCachedData ( ) : boolean
return boolean
    private function getCachedData()
    {
        // no search term = no search
        if (!$this->term) {
            return false;
        }
        // debug mode = no cache
        if (SPOON_DEBUG) {
            return false;
        }
        // check if cache file exists
        if (is_file($this->cacheFile)) {
            return false;
        }
        // get cache file modification time
        $cacheInfo = @filemtime($this->cacheFile);
        // check if cache file is recent enough (1 hour)
        if (!$cacheInfo || $cacheInfo < strtotime('-1 hour')) {
            return false;
        }
        // include cache file
        require_once $this->cacheFile;
        // set info
        $this->pagination = $pagination;
        $this->items = $items;
        return true;
    }