Contrib.Cache Module IIS Kernel Cache Profile

Topics: Customizing Orchard, General
Editor
Sep 10, 2012 at 4:42 PM

I recently enabled the maxAge setting inside the Contrib.Cache module for my site. All was going good until I tried to paginate on my blog posts page. IIS was not varying the cache by querystring so /blog?page=2 was returning my /blog content.

I looked in the OutputCacheFilter.cs file of Contrib.Cache and found that it is was varying by a bunch of different headers but not adding a profile for querystring.

I am going to try and adding the varyByQuerystring option in the Filter and was wondering if anyone else had experience with this or has added it and had success.

 

Thanks

Coordinator
Sep 12, 2012 at 6:13 PM

Are you sure you're using the latest version of Contrib.Cache?

Editor
Sep 18, 2012 at 12:48 PM

Yes I am using version 1.1. What I was seeing was when I turned on the maxAge setting my pagination was not working. /blog page was being cached and there was no distinction between /blog?page=2. I opened up Contrib.Cache OutputCacheFilter.cs and added this line to the ApplyCacheControl method. 

response.Cache.VaryByParams["page"] = true;

This seems to have fixed the issue. My question was more, "has anybody else experienced this?". And is it expected when using maxAge right now?

Coordinator
Sep 18, 2012 at 4:44 PM

Yes, we've experienced that on orchardproject.net. Vary by should probably be configurable.