Copied to clipboard

Flag this post as spam?

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


  • Ed Parry 64 posts 249 karma points c-trib
    Apr 25, 2013 @ 10:28
    Ed Parry
    0

    A Media equivalent of Document/Node?

    I'm aware that for standard content in an Umbraco site, we have the option of using either Document or Node in C# to access their properties and other data. Document makes a call to the database, while Node uses the cache and so is often much quicker and less resource-hungry.

    I've built a media management tool, and while it works great, there's a 2/3-second delay on the initial page load, which is while - I assume - it makes X number of calls to a database to fetch all Media items of a certain type, which at the moment there are ~150 items.

    So is there a Node equivalent for Media? Or does Node work for both Media and Documents?

  • Hendy Racher 859 posts 3820 karma points MVP admin c-trib
    Apr 25, 2013 @ 10:42
    Hendy Racher
    0

    Hi Ed,

    I wonder if any of the uQuery.GetMedia.... methods could help ? internally they each hit the DB once to build an xml representation of all media which is then queried, but for better performance how about caching this media xml in your code via uQuery.GetPublishedXml(uQuery.UmbracoObjectType.Media) ?

    HTH,

    Hendy

  • Ed Parry 64 posts 249 karma points c-trib
    Apr 25, 2013 @ 10:49
    Ed Parry
    0

    Hi Hendy,

    Thanks for your response. uQuery does look like the way to go, but unfortunately the project I'm working on is using 4.7.2, and it looks like uQuery was added in 4.8. I can't imagine that this would be enough to pursuade an upgrade, either, sadly. Thanks for the tip, though -- I hadn't come across uQuery before, so will hopefully get a chance to try it out on the next project!

    Ed

  • Hendy Racher 859 posts 3820 karma points MVP admin c-trib
    Apr 25, 2013 @ 10:53
    Hendy Racher
    0

    Hi Ed,

    In that case, if you have uComponents installed, then uQuery is in there... (the only difference being its namespace)

    Hendy

  • Charles Afford 1163 posts 1709 karma points
    Apr 25, 2013 @ 21:27
    Charles Afford
    0

    You could use a DynamicMedia object :)

Please Sign in or register to post replies

Write your reply to:

Draft