会话和缓存之间的区别

发布于 2025-01-07 22:14:57 字数 114 浏览 0 评论 0原文

谁能列出会话和缓存之间的主要区别?
因为在我看来是一样的,会话也存储在服务器和缓存上。另外,会话用于存储数据以供重用,也用于缓存,微软创建这两个组件的主要区别到底是什么?
现实世界的场景会更有帮助。

Can anyone list the major differences between session and caching?
Because it seems to me as the same, like sessions are also stored on server and caching. Also, session is used to store the data to reuse, caching too, what exactly could be the major difference that Microsoft created these two components?
A real world scenario would be more helpful.

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

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

发布评论

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

评论(3

你穿错了嫁妆 2025-01-14 22:14:57

会话是每个用户的会话。

缓存不是 - 它适用于每个人

Sessions are per user session.

Cache is not - it is for everyone.

禾厶谷欠 2025-01-14 22:14:57

会话是为一个特定用户会话缓存的数据。当用户注销或会话过期时,该数据就会消失,其他用途将无法访问该数据。
缓存通常跨用户会话使用(即为所有用户会话缓存某些内容,而不仅仅是当前用户会话)。

A session is data cached for one specific user session. When the user logs out or the session expires, that data is gone, and other uses won't tap into that data.
Cache is typically used across user sessions (IE something is cached for all user sessions, not just the current user session).

债姬 2025-01-14 22:14:57

会话本质上是缓存的一个特例,用于跟踪 Web 请求/响应的“会话”。

“缓存”是一个经常使用的术语,通常意味着“将某些内容存储在比通常存储速度更快的介质中”。

从服务器开始,ASP.NET 和 IIS 可以通过多种方式为您缓存。在通往客户端的路上,您有代理和 CDN。然后在浏览器中您就有内容的缓存规则。

正如 Raymond Chen 所说,“糟糕的缓存策略与内存泄漏没有区别。”

Session is essentially a special-case of a cache that tracks a 'session' of web requests/responses.

'Cache' is a heavily-used term that generally means 'store something in a faster media' than it normally would be stored in.

Starting on the server there are a variety of ways ASP.NET and IIS can cache for you. On the way to the client you have proxies and CDN's. Then at the browser you have caching rules for the content.

As Raymond Chen says, "A poor cache policy is indistinguishable from a memory leak."

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