UnPublish() and Cache problem - is there any workaround?
Hi,
The following code doesnt seems to update the cache properly and so the unpublished node is still available in the live site..
Document doc = new Document( id ); doc.UnPublish(); umbraco.library.UnPublishSingleNode(doc.Id); umbraco.library.UpdateDocumentCache(doc.Id);
I have checked the forums and it seems lot of other ppl reported same issue but couldnt find any solution.. is there any workaround to make this work? May be do the same operations (directly DB also if needed) what Umbraco do when a user unpublish a node from the backoffice..
I don't know for sure, but by some pieces of source code that I read before I would guess that Umbraco keep a copy of content cache (by default App_Data/umbraco.config) in memory and when it makes a 'small' change like updating, deleting or publishing a document it first makes this change to the in-memory copy and then flush it to the disk using a background thread. On the contrary when some 'big' change is being made like rebuilding the whole cache, umbraco makes it using a copy of the cache while the initial copy remains alive and able to serve incoming requests till the processed copy is ready. Again, it's only my speculations based on skimming over the code, and I'd also be glad to get more information from someone who could know better.
UnPublish() and Cache problem - is there any workaround?
Hi,
The following code doesnt seems to update the cache properly and so the unpublished node is still available in the live site..
Document doc = new Document( id );
doc.UnPublish();
umbraco.library.UnPublishSingleNode(doc.Id);
umbraco.library.UpdateDocumentCache(doc.Id);
I have checked the forums and it seems lot of other ppl reported same issue but couldnt find any solution.. is there any workaround to make this work? May be do the same operations (directly DB also if needed) what Umbraco do when a user unpublish a node from the backoffice..
Any help on this will be greatlely appreciated..
Thanks.
Hello, Anz. Does your site run on a single server or on a web-farm?
@Rodion - its a web farm...
Ok, so have you set the 'distributedCall' option to 'true' in the 'umbracoSettings.conf' file?
@Rodion - sorry the bug is even there in the local development copy.. so its not related to the load balancing..
using
umbraco.library.RefreshContent();
seems working fine and refreshing the cache..
Does it have any side effect in using huge websites with 1000s of pages?
I don't know for sure, but by some pieces of source code that I read before I would guess that Umbraco keep a copy of content cache (by default App_Data/umbraco.config) in memory and when it makes a 'small' change like updating, deleting or publishing a document it first makes this change to the in-memory copy and then flush it to the disk using a background thread. On the contrary when some 'big' change is being made like rebuilding the whole cache, umbraco makes it using a copy of the cache while the initial copy remains alive and able to serve incoming requests till the processed copy is ready. Again, it's only my speculations based on skimming over the code, and I'd also be glad to get more information from someone who could know better.
is working on a reply...