Friday, 30 September 2016

Sitecore MVC – Custom Vary by cache options

Sitecore, by default, provides varies options like Vary by Data, Vary by Query String to enable HTML cache. Sometimes none of these options (based on component built type) help the component to get cached by Sitecore cache.

This module helps in adding options to cache based on URL and Rendering Unique ID.

After installation, you will see two options in caching section of rendering definition.
-      Vary by URL
Cache key varies by HttpContext AbsolutePath
Can be combined with other options like query string (existing)
-      Vary by Unique ID
Uses rendering unique ID

Also, page presentation component properties will have the same option and there will be an additional option to disable the rendering definition cache settings – Cancel Cache Settings. (ref link)

Now you enable cache based on incoming URL and rendering Unique ID. Also disable the rendering cache setting in Page presentation component properties. 

No comments:

Post a Comment

Articles

Automatically create new version for Lock & Edit without workflow

Sitecore will create a new version on Lock and Edit if the item is tied to a workflow. For our case, version has to be created even withou...