Sitefinity MVC Feather Widgets - prevent caching

Posted by Community Admin on 04-Aug-2018 23:20

Sitefinity MVC Feather Widgets - prevent caching

All Replies

Posted by Community Admin on 18-Aug-2016 00:00

I'm using the feather package and building feather widgets for Sitefinity 9.1. I can't seem to override the Output Cache for the widgets using the OutputCache attribute: [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]. I don't want to have to disable caching at the page level, just at the widget level. How do I disable caching at the widget level in Sitefinity?

Posted by Community Admin on 30-Aug-2016 00:00

Hi Adam, check out the Feather implementation for the login widget. 

github.com/.../LoginStatus

github.com/.../login-status.js

 

In my office, we've followed a similar pattern using client side javascript calls to actions with [Routes].  I've also seen various posts about implementing cache substitution, but from what I understand cache substitution becomes cumbersome when attempting to render entire razor views.

Posted by Community Admin on 30-Aug-2016 00:00

Hi Ryan. I don't think that Adam mean this one, he asked about servers side output caching.  

I guess it is not possible to override Output Cache only for specific widget and keep cache for another parts of page because sitefinity is not pure asp.net mvc and it has many many wrappers outside of controller. 

Posted by Community Admin on 30-Aug-2016 00:00

I should have been more specific: my response was directly in relation to the fact that the OutputCache attribute is ineffective at preventing caching at a Feather widget level and what I posted was a solution/workaround. The only effective way that we've seen to prevent caching on a widget level is to implement ajax calls to a custom route action. Otherwise, my understanding is that caching would need to be disabled for the entire page.

Posted by Community Admin on 30-Aug-2016 00:00

Yeah, client side code is not an option here, because the content from the widgets needs to be SEO friendly. 

I ended up programatically clearing cache for pages instead. However, I still don't see updates when content related to dynamic modules is changed. 

Could anyone point me to or add a sample for cache substitution in an mvc widget?

 

 

This thread is closed