Bluz\Cache\Adapter\FileBase::writeFile PHP Method

writeFile() protected method

Write string to the file in an atomic way
protected writeFile ( string $fileName, string $content ) : boolean | integer
$fileName string
$content string
return boolean | integer The number of bytes that were written to the file, or false on failure
    protected function writeFile($fileName, $content)
    {
        $tempFileName = $fileName . uniqid('', true) . '.temp';
        $bytes = file_put_contents($tempFileName, $content);
        if ($bytes !== false) {
            if (rename($tempFileName, $fileName)) {
                return $bytes;
            }
            @unlink($tempFileName);
        }
        return false;
    }