📜  缓存和 Cookie 的区别

📅  最后修改于: 2021-09-10 03:05:55             🧑  作者: Mango

缓存Cookie都是为了提高网站性能并通过在客户端机器上存储一些数据来创建额外的可访问性。

Cache 和 Cookie 的主要区别在于,Cache 用于在浏览器期间存储在线页面资源,以便长期运行或减少加载时间。另一方面,cookie 用于存储用户选择,例如浏览会话以跟踪用户偏好。

在上图中,我们可以看到选中了两个选项(一个用于缓存,另一个用于 cookie)从浏览器中删除缓存和 cookie。还有另一个选项,当我关闭浏览器时总是清除这个选项,以便在两个框都被选中时自动清除缓存和 cookie。

让我们看看缓存和 cookie 之间的区别:

S.NO Cache Cookies
1. Cache is employed to store the web site content for the long run purpose. While cookie is employed to store user choices.
2. Cache’s website contents are stored in browser only. While cookie’s contents are stored in both server and browser.
3. It expires manually. While it expires automatically.
4. It consumes large space in terms of capacity. While it consumes less space in terms of capacity.
5. the types of cache are: Browser cache and proxy cache. While the types of cookies are: Transient and persistent cookies.
6. Cache stores the contents like html pages, images, Javascript, CSS etc. While cookie store the contents like browsing sessions and temporary tracking data.
7. Cache does not send the response with requests. While cookie sends the response with requests.