+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Sitefinity MVC Feather Widgets - prevent caching

Sitefinity MVC Feather Widgets - prevent caching

5 posts, 0 answered
  1. Adam
    Adam avatar
    23 posts
    Registered:
    05 Apr 2013
    18 Aug
    Link to this post
    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?
  2. Ryan
    Ryan avatar
    0 posts
    Registered:
    18 Oct 2013
    30 Aug
    Link to this post

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

    https://github.com/Sitefinity/feather-widgets/tree/master/Telerik.Sitefinity.Frontend.Identity/Mvc/Views/LoginStatus

    https://github.com/Sitefinity/feather-widgets/blob/master/Telerik.Sitefinity.Frontend.Identity/Mvc/Scripts/LoginStatus/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.

  3. Victor Leontyev
    Victor Leontyev avatar
    65 posts
    Registered:
    01 Jul 2014
    30 Aug in reply to Ryan
    Link to this post

    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. 

  4. Ryan
    Ryan avatar
    0 posts
    Registered:
    18 Oct 2013
    30 Aug in reply to Victor Leontyev
    Link to this post
    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.
  5. Adam
    Adam avatar
    23 posts
    Registered:
    05 Apr 2013
    30 Aug
    Link to this post

    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?

     

     

5 posts, 0 answered