Copied to clipboard

Flag this post as spam?

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


  • Jeric 122 posts 192 karma points
    Sep 01, 2014 @ 17:33
    Jeric
    0

    Donut caching question

    How do you call a partial that you need to exclude from parent Cache, and I need to pass in a value into my controller.

    @Html.Action(ActionResultsName, ControllerName, new { valuePassed = "test"}, true)

    But it comes back with some error as. I've checked and it works with either only
    @Html.Action(ActionResultsName, ControllerName, true)

    or

    @Html.Action(ActionResultsName, ControllerName, new {valuePassed = "test"})


    Any help will be great

     

     

    Type 'Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent' cannot inherit from a type that is not marked with DataContractAttribute or SerializableAttribute.  Consider marking the base type 'Umbraco.Web.Models.PublishedContentBase' with DataContractAttribute or SerializableAttribute, or removing them from the derived type.

     


     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Sep 01, 2014 @ 17:43
    Jeroen Breuer
    0

    Hello,

    Sorry I've only used it without passing a value to the controller. Since you don't want to cache this part why do you want to pass a value? That value will be cached because it's not part of the excluded part. Can't you fetch that value in the childaction controller?

    Jeroen

  • Jeric 122 posts 192 karma points
    Sep 01, 2014 @ 17:50
    Jeric
    0

    Hi Jeroen, was about to email you just now.

    Thanks for replying here. 

    I've tried fetching the value in the childaction controller using CurrentPage.

    The issue is, I'm viewing the homepage with child pages. And one of the child pages comes with an MNTP property that select certain node.
    I've tried looping this MNTP to call the @Html.Action that ignore from Parent Cache.

    But in the childaction controller, when I use CurrentPage, it keeps refering to the homepage that i'm viewing instead of the Node i've selected in the MNTP.
    Any work around for this that you might encounter?

    Thanks a lot. Still kind of new on how the Hybrid Framework works :)

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Sep 01, 2014 @ 17:59
    Jeroen Breuer
    0

    Hello,

    In the Hybrid Framework there is an extension method you could try to use. You can use those by adding the Umbraco.Extensions.Utilities namespace.

    This code might not work, but it gives an idea of how it could be done:

    var nodes = CurrentPage.GetMntpNodes("propAlias");
    if(nodes.Any())
    {
    var node = nodes.First();

    Than you have the node you've selected with MNTP in your child action.

    Jeroen

  • Jeric 122 posts 192 karma points
    Sep 01, 2014 @ 19:04
    Jeric
    0

    Found a way, it seems like Html.Action bit doesn't like interface, i was trying to pass the IPublishedContent in previously


    Thanks Jeroen

  • Jeric 122 posts 192 karma points
    Oct 14, 2014 @ 17:59
    Jeric
    0

    Hi Jeroen,

    Quick question about Donut Caching, I've tested out the Donut Caching bits today not sure if you encountered similar things.

    I've created a profiles in the web.config and during development i've set this to 0.

    But when I turn the duration value now to like 900 (which is 15 mins).

    The first time i load a page, everything seems to load fine, but when I refresh the page like pressing Ctrl + F5.

    The page then loads without any styles (like just plain text). Have you encountered this before?

     I'm using ClientDependency as well. 

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 14, 2014 @ 18:01
    Jeroen Breuer
    0

    Hello,

    Sorry I haven't encountered this before. How do you load the styles in the website?

    Btw I've also released a version of the Hybrid Framework for Umbraco 7: http://our.umbraco.org/projects/developer-tools/hybrid-framework-for-umbraco-v7

    Jeroen

  • Jeric 122 posts 192 karma points
    Oct 14, 2014 @ 18:25
    Jeric
    0

    I'm minifying the css and JS through Client dependency like

    Html.RequiresCss("/Css/style.css", 1);

     

    and then rendering it on the page as below, i'll see if i need to exclude that from the cache
    @Html.RenderCssHere()

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 14, 2014 @ 18:28
    Jeroen Breuer
    1

    I haven't used Client dependency so it might be related to that. You could try Cruncher as an alternative. It works very easy. https://github.com/JimBobSquarePants/Cruncher

    Jeroen

  • Jeric 122 posts 192 karma points
    Oct 14, 2014 @ 18:30
    Jeric
    0

    Thanks Jeroen, will try that out. Cruncher works with Donut Caching right? :)

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Oct 14, 2014 @ 18:33
  • Jeric 122 posts 192 karma points
    Oct 14, 2014 @ 18:34
    Jeric
    0

    Oh sweet. Thanks for the help :)

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Oct 14, 2014 @ 21:14
    Nicholas Westby
    0

    Are you using the built-in output caching, or are you using https://github.com/moonpyk/mvcdonutcaching ? I've had problems with the latter, as it doesn't seem to like complex models (though, maybe the new release has fixed that). One option for complex models would be to serialize them to a string (e.g., using the JSON serializer), and deserialize them in the controller action. Not sure if that's the issue you are having though.

Please Sign in or register to post replies

Write your reply to:

Draft