ASP.NET的缓冲处理

 

Caching Overview

Caching is a technique that is widely used in computing to increase performance by keeping frequently accessed or expensive data in memory. In the context of a Web application, caching is used to hold onto pages or data across HTTP requests and reuse them without the expense of recreating them.
ASP.NET has two kinds of caching that can be utilized by Web applications.

  • Caching the dynamic response generated by a request is known as Output Caching.
  • The caching of arbitrary objects programmatically is known as Data Caching. To support this, ASP.NET provides a full featured Cache engine that allows programmers to easily hold onto data across requests.

Output caching is useful when the contents of an entire page can be cached. On a heavily accessed site, caching frequently accessed pages for even a minute at a time can result in substantial throughput gains. While a page is cached by the output cache, subsequent requests for that page are served from the output page without executing the code that created it.

Sometimes it's not practical to cache an entire page--perhaps portions of the page must be created or customized for each request. In this case, it's oftentimes worthwhile to identify objects or data that are expensive to construct that are eligible for caching. Once these items are identified, they can be created once and then cached for some period of time.

Choosing the time to cache an item can make for an interesting decision. For some items, the data might be refreshed at regular intervals or the data is valid for a certain amount of time. In that case, the cache item can be given an expiration policy that will cause them to be removed from the cache when they're expired. Code that accesses the cache item simply checks for the absence of the item, and recreates it if necessary.

The ASP.NET cache supports file and cache key dependencies, allowing developers to make a cache item dependent on an external file or another cache item. This technique can be used to invalidate items when their underlying data source changes.

时间: 2024-09-17 04:33:58

ASP.NET的缓冲处理的相关文章

如何写出优秀的ASP应用文章

什么是ASP Active Server Page,简称ASP,是: l连接网友界面(HTML)和商业逻辑(Business Logic): l提供一致的.容易使用的.有状态保持的.基于WEB的客户端: l为那些需要事务处理的WEB 应用提供应用程序环境. ASP不是: l 实现商业逻辑(Business Logic)的地方:商业逻辑应该通过COM+.MTS或者数据库来实现. ASP的使用者应该有下面的教训: l 开发应用程序,而不是开发一个一个的孤立ASP页面: l 对输入和输出进行缓存: l

如何写出优秀的ASP应用 (2)

   部件      . 性能   . 伸缩性   . 分离商务逻辑和页面表现   . 被ASP或其他环境重用   . 事务处理   . 类型安全   . 存取操作系统特性   . 保护知识产权   . 在下列情况下使用Server.CreateObject:   . MTS事务处理   . 上下文安全性   . ASP内部部件   . OnStartPage.OnEndPage   . 使用<Object RunAt=server>延迟对象初始化   . 是否保存到Session或者Appl

如何写出优秀的ASP应用程序

程序 怎样创建鲁棒性.正确性.可维护性和性能俱佳的ASP应用程序?要做什么?不做什么?本文以提纲的形式,给出了主要的Check-Points(检查点). 什么是ASP Active Server Page,简称ASP,是: l连接网友界面(HTML)和商业逻辑(Business Logic): l提供一致的.容易使用的.有状态保持的.基于WEB的客户端: l为那些需要事务处理的WEB 应用提供应用程序环境. ASP不是: l 实现商业逻辑(Business Logic)的地方:商业逻辑应该通过C

Asp.NET中常用的一些优化性能的方法

asp.net|性能|优化 Asp.NET中常用的一些优化性能的方法 ASP.NET 的缓存机制相比ASP有很大的改进,本文档除对常用优化方法进行总结介绍外,强调了如何使用ASP.NET的缓存来获得最佳性能. 1:不要使用不必要的session和ASP中一样,在不必要的时候不要使用Session. 可以针对整个应用程序或者页面禁用会话状态: l 禁用页面的会话状态 l 禁用应用程序的会话状态 在应用程序的Web.Config文件的sessionstate配置节中,将mode属性设置为off. 即

asp下Response.Buffer提速_应用技巧

 for i=1 to 256   yongfa365=yongfa365&"<!--这里主要是让前边先产生256个字符,这样才可以实时输出-->"   if len(yongfa365)>=256 then exit for  next         MadeBasic()         MadeModel()         MadeIndexBlogItem()                 response.Write "1/6所有模版

【翻译】WCF4.5:更少的配置和ASP.NET更好的支持

原文地址: http://www.infoq.com/news/2012/02/WCF-4.5   Ido Flatow发表了一些列的博客,来讲述.NET4.5中关于WCF的更新 链接地址: http://blogs.microsoft.co.il/blogs/idof/archive/2011/10/05/what-s-new-in-wcf-4-5-automatic-https-endpoint-for-iis.aspx (有时间的话我会陆续翻译)   出于削减复杂性的目的,WCF自动生成的

asp下Response.Buffer提速

for i=1 to 256   yongfa365=yongfa365&"<!--这里主要是让前边先产生256个字符,这样才可以实时输出-->"   if len(yongfa365)>=256 then exit for  next         MadeBasic()         MadeModel()         MadeIndexBlogItem()                 response.Write "1/6所有模版生

[转]性能比较:.NET Remoting 与 ASP.NET Web 服务

http://www.cnblogs.com/cheatlove/articles/385119.html 摘要:本文对 Microsoft ASP.NET Web 服务与 Microsoft .NET Remoting 的相对性能进行比较.Microsoft ASP.NET Web 服务的互操作性最好,并完全支持 HTTP 上的 WSDL 和 SOAP:而 Microsoft .NET Remoting 可实现公共语言运行库类型系统的高保真,并支持其他数据格式和通信通道. 从 MSDN Cod

ASP中缓冲的启用及执行速度的影响

ASP缓冲的启动方法:     1. IIS中设置缓冲默认状态为启动      - 在IIS点击网站点击网站属性      - 选择主目录,按Alt+G或点击配置按钮      - 选择应用程序选项,选中启用缓冲            如果不设置,Win2K中,IIS的默认缓冲为打开状态    2. ASP程序强制打开或关闭      - 强制打开,在合适位置或入语句        Response.Buffer=True      - 强制关闭,在合适位置或入语句        Respons