在Asp.Net实时缓存和会话的区别 [英] Difference between cache and session in real time for Asp.Net

查看:112
本文介绍了在Asp.Net实时缓存和会话的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好所有我是新来Asp.Net谁能告诉我什么是实时缓存和会话之间的区别。

Hello all i am new to Asp.Net could anyone tell me what is the difference between cache and session in real time.

推荐答案

会话:
会话是用来存储数据,这是用户特定的。它可以通过从网站访问。会议有4种模式:

Session: Session is used to store data,It is user specific. It can be accessible through out the site. Session has 4 modes:


  1. 在PROC(数据存储在内存中)

  2. 状态服务(数据存储在一个服务,好处是如果你的应用程序重新启动会话依然存在)

  3. SQL服务器(同样的好处,因为状态服务器)

  4. 在PROC(不包括饼干)一个SESSION_ID连接到URL。当用户已经停用Cookie,这是使用。

例如:

Session["key"] = "value"; // You can store any object data type.

缓存:
有两种类型的缓存在asp.net中。

Cache: There are two types of cache in asp.net.


  1. 页面输出缓存::您可以通过在page.It商店的渲染页面的缓存上指定PageOutput direcitve缓存整个页面。当你的网页是由成千上万的用户访问它被使用,所以增加了响应时间,我们缓存的页面。

  2. 应用程序缓存:它允许在内存中存储的任何对象,并根据一定的局限性例如时间或其他一些依赖自动删除的对象。
    例如:

  1. Page Output Caching: You can cache the whole page by specifying the PageOutput direcitve at the top of the page.It store's the rendered page in the Cache. It is used when your page is accessed by thousands of users, so to increase the response time, we cache that page.
  2. Application Caching: It allows to store any object in memory and automatically removed the object based on some limitations e.g time or some other dependencies . Example:

缓存[键] =值; //它还支持任何对象数据类型。

记住缓存和Session是不同的东西。

Remember Cache and Session are different things.

这篇关于在Asp.Net实时缓存和会话的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆