Cache和Buffer的区别

时间:2022-10-27 15:14:00

一、研究数据库的人这样理解:http://wenku.baidu.com/view/32b8b13e376baf1ffc4fad7e.html

Cache和Buffer是两个不同的概念,简单的说,Cache是加速“读”,而buffer是缓冲“写”,前者解决读的问题,保存从磁盘上读出的数据,后者是解决写的问题,保存即将要写入到磁盘上的数据。在很多情况下,这两个名词并没有严格区分,常常把读写混合类型称为buffer cache。

A buffer is something that has yet to be "written" to disk. A cache is something that has been "read" from the disk and stored for later use.

二、编程序的人最好这样理解:http://wiki.answers.com/Q/The_difference_between_buffer_and_cache

Think of it like this: a “Buffer” is an area where data moves back and forth between two objects. A “Cache” is where data is stored when it  may not be immediately needed, but might be soon. A buffer is like a hallway between two rooms, and a cache is like a closet. Get it?