Copied to clipboard

Flag this post as spam?

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


  • Lee 1123 posts 3059 karma points
    Jan 05, 2012 @ 16:30
    Lee
    0

    Question About UpdateDocumentCache?

    I have a base extension which creates 3 new Documents one after the other (They all look simialr to the below)

    var p = new Document(Id);
    p.getProperty("property").Value = 1;
    p.Publish(usr);
    umbraco.library.UpdateDocumentCache(p.Id);

    I was wondering about the 'UpdateDocumentCache' call at the end of each one..

    I'm currently looking at performance increases, and wondering if I need to call this after each one? Or can I just call it once at the end and it will update the document cache with all three nodes?

    Anyone else had a similar situation?

     

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Jan 05, 2012 @ 16:45
    Stefan Kip
    0

    I allways call UpdateDocumentCache...

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Jan 05, 2012 @ 16:47
    Lee Kelleher
    0

    I tend to call UpdateDocumentCache too ... however an alternative could be to not call it for each new Document, then at the end, make a call to umbraco.library.RefreshContent()?

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Jan 05, 2012 @ 16:49
    Stefan Kip
    0

    RefreshContent is evil if I remember correctly, it has problems with sync locking...

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Jan 05, 2012 @ 16:54
    Lee Kelleher
    0

    Are you sure? It's used internally by a many parts of the core.

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Jan 05, 2012 @ 16:58
    Stefan Kip
    0

    No I'm not sure... Don't know what it was, but if I see RefreshContent, for some reason I want to leave.. :-/

  • Lee 1123 posts 3059 karma points
    Jan 05, 2012 @ 19:51
    Lee
    0

    Whats the difference between umbraco.library.RefreshContent() and umbraco.library.UpdateDocumentCache()?

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Jan 05, 2012 @ 21:04
    Lee Kelleher
    0

    RefreshContent() will regenerate the entire XML cache (in memory, but dumped to umbraco.config) from the cmsContentXml database table, where as UpdateDocumentCache(id) would only generate the XML for a single content node and append/replace that in the XML cache (again, in memory, but dumped to umbraco.config).

    Cheers, Lee.

  • Lee 1123 posts 3059 karma points
    Jan 06, 2012 @ 07:21
    Lee
    0

    I suppose the question is...  With a large site, say a 100 to 300mb XML config - Which would be more efficient/faster?  One entire regeneration of the config, or 3 append/replaces :|

  • Stefan Kip 1606 posts 4098 karma points c-trib
    Jan 06, 2012 @ 09:16
    Stefan Kip
    0

    Well, you could measure it by using the Stopwatch class? :-)

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Aug 14, 2012 @ 15:51
    Jeavon Leopold
    0

    I would be interested to know if anyone ever found an answer to this? We have a site with a lot of nodes where each call to UpdateDocumentCache is taking between 20 and 30 seconds to execute which is frustrating, we are considering somehow threading it, any other suggestions.....?

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Aug 14, 2012 @ 15:55
    Lee Kelleher
    0

    @Jeavon, gut feeling is that the delay is related to the UmbracoSiteMapProvider - could try removing the entry from your web.config, see if that makes a difference?

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    Aug 14, 2012 @ 16:01
    Jeavon Leopold
    0

    Hi Lee,

    That's a very good thought, however we have already killed off the sitemap provider in web.config :-(

    Thanks,

    Jeavon

  • jeeshna 6 posts 26 karma points
    Aug 17, 2012 @ 07:24
    jeeshna
    0

    Hi Lee,

    In one of my project, I have used "mydocument.publish(createdUser);umbraco.library.UpdateDocumentCache( mydocument .Id)" for publishing. But this 2 lines of code takes 20 to 30sec for execution. 

    So i replace this two line of code with umbraco.library.RefreshContent() . It takes only millisecinds.

    The problem is that , in one of my page , we have taken this node as "myNode = Node.GetCurrent();”, it return previous data(not updated one). But in other page we have taken this node as" Document mydoc= new Document(nodeid);” ,it returns updated one.

    Please help me by saying  why this show a strage behaviour.

     Thanks

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies