buki\Cache::getCache PHP Method

getCache() public method

public getCache ( $sql, $array = false )
    public function getCache($sql, $array = false)
    {
        if (is_null($this->cache)) {
            return false;
        }
        $cacheFile = $this->cacheDir . $this->fileName($sql) . '.cache';
        if (file_exists($cacheFile)) {
            $cache = json_decode(file_get_contents($cacheFile), $array);
            if (($array ? $cache['finish'] : $cache->finish) < time()) {
                unlink($cacheFile);
                return;
            } else {
                return $array ? $cache['data'] : $cache->data;
            }
        }
        return false;
    }