Jump to content
  • Advertisement
Sign in to follow this  
zaidgs

[web] ASP.NET Advanced Caching

This topic is 3927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In order to fine-tune the caching process to my needs I use VaryByCustom="custom" directive in output caching. Now, I can return different key-strings to store different caching versions, but I want that in certain scenarios that caching to not to happen. What is the best way to not cache a particular version of a page?! Is there someway I can return a "special" key to invalidate caching? [Edited by - zaidgs on September 16, 2007 5:17:47 PM]

Share this post


Link to post
Share on other sites
Advertisement
Thank you capn_midnight for the link... I already know how to do the things described there, but I think I might not have been clear about what I want.

Consider the example they give in that article about caching different pages based on "Language" item found in a cookie. Check the code snippet they provided:

public override string GetVaryByCustomString(HttpContext context, string arg)
{
if (arg.ToLower() == "cookies")
{
HttpCookie cookie = context.Request.Cookies["Language"];
if (cookie != null)
{
return cookie.Value;
}
}
return base.GetVaryByCustomString(context, arg);
}


Consider now the scenario that you want English, French, and German pages to be cached as expected, but that Spanish and Chinese pages to never get cached... How would I do that?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!