CacheBae::get PHP Метод

get() публичный Метод

+---------------------------------------------------------- 读取缓存 +---------------------------------------------------------- +----------------------------------------------------------
public get ( string $name ) : mixed
$name string 缓存变量名 +----------------------------------------------------------
Результат mixed +----------------------------------------------------------
    public function get($name)
    {
        N('cache_read', 1);
        $content = $this->_handler->get($name);
        if (false !== $content) {
            if (C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
                $content = substr($content, 0, -1);
                //remvoe \0 in the end
            }
            if (C('DATA_CACHE_CHECK')) {
                //开启数据校验
                $check = substr($content, 0, 32);
                $content = substr($content, 32);
                if ($check != md5($content)) {
                    //校验错误
                    return false;
                }
            }
            if (C('DATA_CACHE_COMPRESS') && function_exists('gzcompress')) {
                //启用数据压缩
                $content = gzuncompress($content);
            }
            $content = unserialize($content);
            return $content;
        } else {
            return false;
        }
    }