Cache_Lite::_writeAndControl PHP Method

_writeAndControl() public method

Write the given data in the cache file and control it just after to avoir corrupted cache entries
public _writeAndControl ( string $data ) : boolean
$data string data to put in cache
return boolean true if the test is ok (else : false or a PEAR_Error object)
    function _writeAndControl($data)
    {
        $result = $this->_write($data);
        if (is_object($result)) {
            return $result;
            # We return the PEAR_Error object
        }
        $dataRead = $this->_read();
        if (is_object($dataRead)) {
            return $result;
            # We return the PEAR_Error object
        }
        if (is_bool($dataRead) && !$dataRead) {
            return false;
        }
        return $dataRead == $data;
    }