Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ault Nathanielsz 64 posts 279 karma points
    Jun 24, 2020 @ 16:01
    Ault Nathanielsz
    0

    @Html.CachedPartial - Documentation clarification

    I am seeking clarification for a line I saw in the documentation:

    Also, the cache of all CachedPartials is emptied on Umbraco publish events.

    Does this mean that any publish event clears all cachedpartials?

    Or that a publish event clears only those cachedpartials related to the published item's view?

    ALSO

    What other events would clear these cachedpartials?

  • Liam Dilley 79 posts 205 karma points
    Jun 25, 2020 @ 01:51
    Liam Dilley
    0

    It says that but I do not find that to always be the case. I still find going into Umbraco Published Status And refreshing there sorts it in Umbraco 8. I like many just run on the views as files, editing a partial view through the admin and hitting save probably does a refresh and that is probably what they mean.

    I got fed up with it sometimes as these days it seems to be a harder cache then it used to in say 7.4ish so I just use normal partials on a build and change before going live.

  • Paul Seal 425 posts 2326 karma points MVP 3x c-trib
    Jun 25, 2020 @ 09:16
    Paul Seal
    0

    As far as I know, when you do a Save and Publish on any node, it invalidates the cache for all cached partials.

    A good experiment here would be to add this to your partials and macro partials which you want to test the cache for:

    <p>Partial Last Cached at @(DateTime.Now.ToString())<p>
    

    or

    <p>Macro Partial Last Cached at @(DateTime.Now.ToString())<p>
    

    Then you can restart your app pool

    Navigate all of the pages in question, see that the last cached time stays the same for each of the partials and then do a Save and Publish. You can then go back and see if any or all of the last cached times change.

    You will then be able to test out the other actions to see if they can cause the cache to be invalidated.

    And lastly it would be good if you wrote a blog post about your findings so we can all read it. If you don't have your own blog, I'd be happy to have you write it as a guest post on codeshare if you want.

Please Sign in or register to post replies

Write your reply to:

Draft