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?
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.
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).
Media not updating properly
I'm updating a media item through the api (4.0.x), like so:
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?
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.
Sorry, using 4.0.x... :-)
hrmmm.
this call generally writes to the db straight away:
(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?
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!
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
Ha, good catch! I always use that one for documents, but obviously it also works with media. Thanks, that works perfectly!
is working on a reply...