phprs\util\FileCache::get PHP Method

get() public method

模拟apc, 只在没有apc的开发环境使用
public get ( string $key, boolean &$succeeded = null ) : mixed
$key string
$succeeded boolean
return mixed object on success or false on failure
    public function get($key, &$succeeded = null)
    {
        $succeeded = false;
        $path = $this->cache_dir . '/' . sha1($key);
        if (!file_exists($path)) {
            return false;
        }
        $res = file_get_contents($path);
        if ($res === false) {
            return false;
        }
        $succeeded = true;
        return unserialize($res);
    }