Copied to clipboard

Flag this post as spam?

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


  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Feb 02, 2016 @ 16:35
    Biagio Paruolo
    0

    Umbraco Caching: @Html.CachedPartial

    Hi,

    Could you explain better the @Html.CachedPartial Umbraco helper and the pro / cons ( see user sessions, login, etc. )?

    Thank you

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Feb 02, 2016 @ 18:31
    Alex Skrypnyk
    0

    Hi Biagio,

    Html.CachedPartial - my favourite helper. It can boots performance fast and easy.

    From docs: So you can specify to cache by member and/or by page and also specify additional view data to your partial view. However, if your view data is dynamic (meaning it could change per page request) the cached output will still be returned. This same principle applies if the model you are passing in is dynamic. Please be aware of this: if you have a different model or viewData for any page request, the result will be the cached result of the first execution.

    We are using this helper before final testing, when active development phrase finished.

    Thanks,

    Alex

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Feb 02, 2016 @ 19:41
    Biagio Paruolo
    0

    Are there some troubles with dynamic page or secured page? Some time ago, I had a big problem with OutputCache...some users see cached data of others!

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Feb 02, 2016 @ 21:19
    Alex Skrypnyk
    0

    Biagio, if you specify cacheByMember = true, application will show partial depends on current member.

    IHtmlString CachedPartial(
        string partialViewName,
        object model,
        int cachedSeconds,
        bool cacheByPage = false,
        bool cacheByMember = false,
        ViewDataDictionary viewData = null)
    

    Thanks, Alex

  • Eric Petersson 33 posts 117 karma points
    Feb 02, 2016 @ 20:49
    Eric Petersson
    0

    If you're using dynamic data input from let's say a model that is changing by requests per page you will end up by not receiving the effect you're after.

    Unfortunately that is out of the box Html.CachePartial functionality. You may find out more about it at the bottom of this page: https://our.umbraco.org/documentation/Reference/Templating/Mvc/partial-views

  • Biagio Paruolo 1618 posts 1910 karma points c-trib
    Feb 03, 2016 @ 07:02
    Biagio Paruolo
    0

    I think that CachePartial is better to use where are not a lot variable data.

Please Sign in or register to post replies

Write your reply to:

Draft