Prado\I18N\core\TCache_Lite::_read PHP Method

_read() public method

Read the cache file and return the content
public _read ( ) : string
return string content of the cache file
    function _read()
    {
        $fp = @fopen($this->_file, "rb");
        if ($this->_fileLocking) {
            @flock($fp, LOCK_SH);
        }
        if ($fp) {
            // because the filesize can be cached by PHP itself...
            clearstatcache();
            $length = @filesize($this->_file);
            if ($this->_readControl) {
                $hashControl = @fread($fp, 32);
                $length = $length - 32;
            }
            $data = @fread($fp, $length);
            if ($this->_fileLocking) {
                @flock($fp, LOCK_UN);
            }
            @fclose($fp);
            if ($this->_readControl) {
                $hashData = $this->_hash($data, $this->_readControlType);
                if ($hashData != $hashControl) {
                    @touch($this->_file, time() - 2 * abs($this->_lifeTime));
                    return false;
                }
            }
            return $data;
        }
        $this->raiseError('Cache_Lite : Unable to read cache !', -2);
        return false;
    }