asp.net - programmatically control output caching - disable or enable cache according to parameter value -


For us to endorse lists of our products within the categories fairly standard e-commerce landscape is better or worse, almost 80% of visitors never navigate according to the first page, depending on the category, then there can be 5-10 more pages of results, which have been seen in less time so far. (Yes we do appears on the first page are optimized and good looking - but it is a different discussion)

We can not check every page of results, because we are constrained by memory , But the benefit of caching will only be bigger in the first page of the results of each category.

I know that I can do something by using object caching to store the dataset in question, but it is possible using the output caching, perhaps using the feedback. Catch object?

Where can this be done in the page life cycle? Pre-render?

is very simple, the URL is "/ Product List" class = more page = 1 ", and I want some logic (eg pseudocode):

  if parameters Use "page" equal 1 output caching: Ultimate = "Category name; Do not use different caching as "other, just put the page from scratch or  

We are using the Aspiknet 2.0, IIS 6 / win2003.

< / p>

  if (yourArbitraryCondition) {OutputCacheParameters outputCacheSettings = new OutputCacheParameters (); OutputCacheSettings.Duration = 60; InitOutputCache (outputCacheSettings);}  

the OnInit fix it Should work and jah Rate, so you can do more caching behavior by setting various properties on output Kachepametr which all as directed by the same knobs (In fact, when we use the instructions we generated). < / P>

The key point is that you are only executing this argument conditionally, while the instructions make it unconditional.

Update:

As an alternative, you can use Imn level cache API is built on the above address. E.g.

  HttpCache policy cache = Response Cache; Cache.SetCacheability (HttpCacheability.Public); Cache.SetExpires (Context.Timestamp.AddSeconds (60)); Cache.WorburyParam ["classname"] = true; Actually, this is another way of doing the same thing, without the use of any API, it is not marked as 'should be called'. In the end, someone The method also works, so make your selection. 


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -