如何使用 Visual Basic .NET 在 asp.NET 中执行片段缓存
概要
本文演示如何在 asp.NET 中实现片段缓存。实际上,片段缓存并不直接缓存 Web 窗体的代码片段;片段缓存指的是缓存 Web 窗体中的各个用户控件(.ascx)。各个用户控件可以有独立的缓存持续时间和缓存行为的实现方式。本文中的代码示例演示了如何实现此功能。
片段缓存在您只想缓存页面的一个子集时很有用。当不必为每个请求都动态生成输出时,应该使用片段缓存和其他形式的输出缓存。导航栏、页眉、页脚以及其他可以实现为用户控件的代码片段就是很好的片段缓存候选对象,并且由于可以从缓存中检索其输出而改进了性能。 (毕业设计)
要求
• Microsoft Windows 2000
• Microsoft Internet Information Server (IIS)
• Microsoft .NET Framework
• Microsoft asp.NET
使用 Visual Basic .NET 创建 asp.NET Web 应用程序
下列步骤演示如何新建一个名为 FragmentCache 的 asp.NET Web 应用程序。
How To Perform Fragment Caching in asp.NET by Using Visual Basic .NET
SUMMARY
This article demonstrates how to implement fragment caching in asp.NET. Fragment caching does not actually cache a Web Form''s code fragments directly; fragment caching refers to the caching of inidual user controls (.ascx) within a Web Form. Each user control can have independent cache durations and implementations of how the caching behavior is to be applied. The sample code in this article illustrates how to achieve this functionality.
Fragment caching is useful when you need to cache only a subset of a page. You should use fragment caching and other forms of output caching in situations where the output does not necessarily need to be dynamically generated for each request. Good candidates for fragment caching are navigation bars, headers, footers, and other code fragments that can be implemented as user controls and may benefit from the performance gains that are associated with having their output retrieved from a cache.
全文 4800字