“缓存”之间的区别是什么和“数据存储”?

发布于 2025-01-22 23:11:20 字数 201 浏览 4 评论 0原文

我试图辨别两者之间的区别,但是这些术语似乎在各个地方可以互换使用。

我看到“缓存”一词是在谈论以后保存文件时最常用的,例如浏览器缓存。

尽管“数据存储”一词倾向于严格用于文本,数组,数据库值等诸如...

我只是回答了自己的问题吗?我不确定...

我主要使用PHP,因此PHP中的任何示例都会有所帮助,但不需要。

谢谢!

I'm trying to discern the difference between the two, however the terms seem to be used interchangeably in various places.

I see the term "cache" is most commonly used when talking about saving files for later, such as browser caching.

Whereas the term "data store" tends to be used strictly for things such as text, arrays, database values etc...

Have I just answered my own question? I'm not sure...

I work mostly with PHP, so any examples in PHP would be helpful but not required.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阳光的暖冬 2025-01-29 23:11:20

PHP是服务器端脚本语言。其他服务器端语言是nodejs,python,java等。同样,有客户端编程语言,例如JavaScript等

。如果在电子商务网站上有一个项目)。该请求转到服务器,服务器在数据库中查找此数据。通常,数据库将此数据存储在磁盘上。通常,从数据库中检索数据是整个通信中最耗时的操作。客户端(浏览器)正在等到服务器随响应返回。为了使此通信更快,可以实现缓存以将最常用的数据存储在内存中。由于从内存中检索数据的速度要快得多(少于1 ms),因此服务器立即用数据响应该请求。

以上是在服务器端实现的缓存的示例。同样,开发人员可以在客户端(例如浏览器缓存)上实现缓存。由于缓存在内存(RAM)中,因此此数据是挥发性和瞬态的。

数据存储是一个基本上用于以任何形式(例如数据库,文件,电子邮件等)表示持续数据的术语。在上面的示例中,缓存是挥发性磁盘可以称为数据存储。

PHP is a server-side scripting language. Other server-side languages are NodeJS, Python, Java, etc. Similaryly, there are client-side programming languages such as Javascript, etc.

In web development, a client (lets say a browser) issues a request (for eg, to see if an item is available on an e-commerce website). The request goes to the server and the server looks up this data in a database. Usually, the database stores this data on disk. Usually, this retrieval of data from the database is the most time-taking operation in the entire communication; and the client (the browser) is waiting until the server returns with the response. To make this communication faster, caches are implemented to store most frequently used data in the memory. Since retrival of data from memory is much faster (less than 1 ms), the server immediately responds to the request with the data.

The above is an example of a cache that is implemented on server-side. Similarly, developers can implement a cache on the client-side (for eg, browser cache). Since the cache is in memory (RAM), this data is volatile and transient.

Data store is a term that is basically used to represent persistent data in any form, such as database, files, emails, etc. In the above example, cache is volatile while the database that stores the data on the disk can be called as data store.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文