moonpyk / mvcdonutcaching

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.
https://github.com/moonpyk/mvcdonutcaching
MIT License
142 stars 49 forks source link

Allow a SkipByCustom string to be specified #39

Closed gareththackeray closed 2 years ago

gareththackeray commented 9 years ago

Sometimes you want to allow the cache to be bypassed entirely. For example if you are in draft mode and you want to preview your changes with a query string parameter or something.

So I've written a SkipByCustom feature that works analogously to VaryByCustom but the delegate returns a bool which then ordains whether the thing should bypass the cache.

Not sure if you'll want to go for this or not. If you do then I can add a little documentation.

Thanks for writing the library in the first place!

gareththackeray commented 9 years ago

I fixed my first commit with a forced push and have now added a second that makes a second check for SkipByCustom before actually caching the response. This means that you can have an action that (say) sets something into HttpContext.Items to indicate that this particular response should not be cached.

moonpyk commented 9 years ago

I'll have a look very soon, I'm quite busy atm with other projects.

Kind regards.