Buffer与Cache的区别

Buffer:
In computer science, a buffer is a region of memory used to temporarily hold data while it is being moved from one place to another. Typically, the data is stored in a buffer as it is retrieved from an  input device  (such as a keyboard) or just before it is sent to an  output device  (such as a printer). However, a buffer may be used when moving data between processes within  a computer
计算机科学中,buffer是指在数据从一个地方移动到另一个地方的过程中数据在内存中的临时存储区域.
一般来讲,档数据"从输入设备(如键盘)得到以后,或在发送到输出设备(如显示器)之前"  后会存入buffer.
当然在同一台计算机上,数据在线程间传输时也会使用buffer.

cache :
In computer science, a  cache  is a  collection of data  duplicating original values stored elsewhere or computed earlier, where the original data is expensive to fetch (in terms of longer access time) or to  compute , compared to the cost of reading the  cache . In other words, a  cache  is a temporary storage area where frequently accessed data can be stored for rapid access. Once the data is stored in the  cache , future use can be made by accessing the cached copy rather than re-fetching or recomputing the original data, so that the average access time is shorter.
在计算机科学中,cache是存储在别的地方的数据或先前计算过的数据的副本,这些数据的源数据的存取是非常昂贵的(跟cache相比读取需要消耗很长的时间).
换句话说,cache是对读取频率极高或需要高速读取的数据的临时存储的地方.
一旦数据存到cache中以后,以后再读取数据就不需要从源数据中重新读取或计算了,可以直接从源数据的拷贝cache中读取,也因此大大缩短了读取时间.

你可能感兴趣的:(buffer)