Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Moment 22 outputcache, is this possible?

Vote:
 

Hello

We are using output cache for current application but for some requests we dont want to response with outputcached content i.e request must hit our business logic. I now that I can use varybyprarams and headers but this will generate a lot of outputcached content and there is a 'risk' to use a lot of memory so we have tried another apporach...

What we have tried is in PageInit of our master page we do:

Response.Cache.AddValidationCallback(new HttpCacheValidateHandler(ValidateCacheOutput), null);

and ValidateCacheOutput-delegate looks like:

public static void ValidateCacheOutput(HttpContext context, Object data, ref HttpValidationStatus status)
{
   if (){
      status = HttpValidationStatus.IgnoreThisRequest;
   }
}Submit

This works fine but it looks like if user are not logged in and user hits: status = HttpValidationStatus.IgnoreThisRequest;

It will not respond with already saved output cached content but...

it will go into business logic for current page and generate new outputcahced content that 'not logged in people' will get when visiting site....my mainproblem is that if-condition must also apply for not logged in visitors else  it could have been working so.... 

Is there a way to tell Episerver to not generate outputcached content for current request (of page) if contidion is fullfilled.

Would be glad if anyone could help me solving this or point me in right direction how to approach this problem

[Pasting files is not allowed]

#91667
Oct 10, 2014 12:44
Vote:
 

Is SetCachePolicy what you are looking for? See http://joelabrahamsson.com/the-episerver-cms-output-cache-explained/

#109634
Oct 10, 2014 16:25
Vote:
 

Thanks, that could maybe help me.

In my case I'm controlling request-head-information so you if I get a hit for request-head-info you are saying that if I'm doing:

context.Response.Cache.SetExpires(DateTime.UtcNow.AddDay(-1));

episerver will not generate  output cached content for specific url?

Thanks!

#109639
Oct 10, 2014 17:46
Vote:
 

EPiServer sets the output caching the method SetCachePolicy, so unless the you call the base implementation you are in full control.

#109663
Oct 13, 2014 8:35
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.