Copied to clipboard

Flag this post as spam?

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


  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 09, 2010 @ 16:21
    Sebastiaan Janssen
    0

    Media not updating properly

    I'm updating a media item through the api (4.0.x), like so:

    var media = new Media(12345);
    media.getProperty("myProperty").Value = "1";
    
    media.Save();
    library.UpdateDocumentCache(media.Id);

    Now when I go to this media item, I can definitely see the myProperty value has updated. However, when I access the same media item from XSLT, it says that it's still 0. 

    Only if I save it in the media section or do an iisreset (touching web.config does not help) do I see the change from my XSLT. 

    Actually, the whole media.Save() should be redundant... What am I missing here?

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Sep 09, 2010 @ 16:37
    Shannon Deminick
    0

    this is due to the new xslt caching in 4.5... pretty sure this was either logged in codeplex a month or so ago, or there was another forum post about it that i replied to.

    I guess if it't not fixed in 4.5.2, then the only work around is to clear that cache item in the httpruntime cache object collection... I'm not sure what name it's cached under but should be pretty obvious.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 09, 2010 @ 16:39
    Sebastiaan Janssen
    0

    Sorry, using 4.0.x... :-)

  • Shannon Deminick 1526 posts 5272 karma points MVP 3x
    Sep 09, 2010 @ 16:41
    Shannon Deminick
    0

    hrmmm.

    this call generally writes to the db straight away:

    media.getProperty("myProperty").Value = "1";

    (i know that's not ideal but thats the way it is)

    Any chance you have macro caching turned on in the macro you are using?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 09, 2010 @ 16:47
    Sebastiaan Janssen
    0

    Yeah I know, actually I'm counting on it! ;-)

    I'm using no cache on the macro, but my own MediaCache package. However, when I do media.Save(), the deleteCache method fires, so it's not my own cache that's the problem (my mediacache saves in Current.Application anyway, which you drop when you touch the web.config).

    It's weird!

  • Sascha Wolter 615 posts 1101 karma points
    Sep 09, 2010 @ 21:08
    Sascha Wolter
    0

    Hi Sebastiaan,

    had the same problem on my last project, solved it by making the following call:

    media.XmlGenerate(new XmlDocument());

    Don't ask me why though... ;)

    Hope that helps,

    Sascha

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 10, 2010 @ 09:47
    Sebastiaan Janssen
    0

    Ha, good catch! I always use that one for documents, but obviously it also works with media. Thanks, that works perfectly!

Please Sign in or register to post replies

Write your reply to:

Draft