什么是FileStream.Flush()和FileStream.Flush(真)之间的区别是什么? [英] What's the difference between FileStream.Flush() and FileStream.Flush(True)?

查看:1748
本文介绍了什么是FileStream.Flush()和FileStream.Flush(真)之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MSDN 说,<一个href="http://msdn.microsoft.com/en-us/library/system.io.filestream.flush.aspx"><$c$c>FileStream.Flush(True) 还会清除所有中间文件的缓冲区。

MSDN says that FileStream.Flush(True) "also clears all intermediate file buffers.".

什么是所有中间文件缓冲区的意思是什么呢?

What does "all intermediate file buffers" mean exactly?

推荐答案

这导致多数民众赞成在缓存文件系统缓存中的文件数据写入到磁盘中。该数据被正常懒惰地写入,基于盘写头的位置。其缓存数据的技嘉在技术上是可能的,因此可能需要相当长的时间。如果这是重要的是你再考虑 FileOptions.WriteThrough 选项。它完全禁用写缓存。这可以是非常昂贵的;你会发现硬盘到底有多慢的。

It causes the file data that's buffered in the file system cache to be written to disk. That data is normally lazily written, based on the position of the disk write head. Having a gigabyte of cached data is technically possible so it can take quite a while. If this is important to you then consider the FileOptions.WriteThrough option instead. It disables write caching completely. This can be very expensive; you'll discover how slow hard disks really are.

这篇关于什么是FileStream.Flush()和FileStream.Flush(真)之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆