Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ASP.NET MVC Extensible Donut Caching brings donut caching to ASP.NET MVC 3 and later. The code allows you to cache all of your page apart from one or more Html.Actions which can be executed every request. Perfect for user specific content.

License

NotificationsYou must be signed in to change notification settings

moonpyk/mvcdonutcaching

Repository files navigation

ASP.NET MVC Extensible Donut Caching brings donut caching to ASP.NET MVC 3 and later. The code allows you to cache all of your page apart from one or more Html.Actions which can be executed every request. Perfect for user specific content.

Build status

Download

The best way to add donut caching to your MVC project is to use the NuGet package. From within Visual Studio, selectTools | Library Package Manager and then choose either Package Manager Console or Manage NuGet Packages. Via the console, just typeinstall-package MvcDonutCaching and hit return. From the GUI, just search forMvcDonutCaching and click the install button.

Usage

The package adds several overloads to the built-in Html.Action HTML helper. The extra parameter in each overload is namedexcludeFromParentCache. Set this to true for any action that should not be cached, or should have a different cache duration from the rest of the page.

@Html.Action("Login","Account",true)

The package also include a DonutOutputCacheAttribute to be used in place of the built-in OutputCacheAttribute. This attribute is typically placed on every controller action that needs be be cached.

You can either specify a fixed duration:

[DonutOutputCache(Duration="300")]publicActionResultIndex(){returnView();}

Or, use a cache profile:

[DonutOutputCache(CacheProfile="FiveMins")]publicActionResultIndex(){returnView();}

If you are using cache profiles, be sure to configure the profiles in the web.config. Add the following within the system.web element:

<caching>  <outputCacheSettings>    <outputCacheProfiles>      <addname="FiveMins"duration="300"varyByParam="*" />    </outputCacheProfiles>  </outputCacheSettings></caching>

You can also configure the output cache to use a custom provider:

<caching>  <outputCachedefaultProvider="DistributedCacheProvider">    <providers>      <addname="DistributedCacheProvider"type="DevTrends.Example.DistributedCacheProvider" />    </providers>  </outputCache></caching>

Note, that a custom provider is not included with this project but you can write one fairly easily by subclassingSystem.Web.Caching.OutputCacheProvider. A number of implementations are also available on the web.

More Information

A comprehensive guide to MVC Extensible Donut Caching is now available on theDevTrends Blog.

About

ASP.NET MVC Extensible Donut Caching brings donut caching to ASP.NET MVC 3 and later. The code allows you to cache all of your page apart from one or more Html.Actions which can be executed every request. Perfect for user specific content.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors9

Languages


[8]ページ先頭

©2009-2025 Movatter.jp