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?
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()?
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).
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 :|
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.....?
@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?
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.
Question About UpdateDocumentCache?
I have a base extension which creates 3 new Documents one after the other (They all look simialr to the below)
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?
I allways call UpdateDocumentCache...
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()?
RefreshContent is evil if I remember correctly, it has problems with sync locking...
Are you sure? It's used internally by a many parts of the core.
No I'm not sure... Don't know what it was, but if I see RefreshContent, for some reason I want to leave.. :-/
Whats the difference between umbraco.library.RefreshContent() and umbraco.library.UpdateDocumentCache()?
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.
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 :|
Well, you could measure it by using the Stopwatch class? :-)
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.....?
@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?
Hi Lee,
That's a very good thought, however we have already killed off the sitemap provider in web.config :-(
Thanks,
Jeavon
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
is working on a reply...