应用VS会话VS缓存 [英] Application vs Session vs Cache
问题描述
这是一个适当的用例上述所有的?这似乎会话和缓存是非常相似的,我不认为申请多大用处。
What is an appropriate use case for all of the above? It seems session and cache are quite similar, and I can't think of much use for application.
推荐答案
应用程序和会话状态有一个非常重要的区别:
Application and Session State have a very important difference:
应用程序状态在ASP.NET应用程序提供给所有的类数据仓库。应用程序状态被存储在服务器上的存储器,并且比存储和在数据库中检索信息更快。 与会话状态,这是特定于单个用户会话,应用程序状态适用于所有用户和会话。因此,应用程序的状态是存储少量经常使用的数据的,不从一个用户改变到另一种有用的地方
Application state is a data repository available to all classes in an ASP.NET application. Application state is stored in memory on the server and is faster than storing and retrieving information in a database. Unlike session state, which is specific to a single user session, application state applies to all users and sessions. Therefore, application state is a useful place to store small amounts of often-used data that does not change from one user to another
缓存,而另一方面,允许你存储在内存对象需要大量的服务器资源来创建 - 它提供了强大的功能,允许您自定义的项目是如何缓存多久他们缓存 - 你可以设置丰富的属性,如优先级和到期
Caching, on the other hand, allows you to store objects in memory that require extensive server resources to create - it offers powerful features that allow you to customize how items are cached and how long they are cached - you can set extensive properties like priority and expiration.
虽然它们可能会出现类似的,它们是完全独立的,并有不同的角色,在其最广泛意义ASP.NET应用程序播放
Although they might appear similar, they are distinctly separate and have different roles to play in an ASP.NET application in its broadest sense.
这篇关于应用VS会话VS缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!