Gravatar for nbo@oxygen.dk

Question by nbo, Feb 1, 2016 9:13 AM

Clear/Refresh cache on publish (Sitecore)

Hi!

When publishing an item to the website, there is a delay before items appear in the list (Roughly 5 minutes). I've linked the problem to the cache, as the item is shown as soon as CacheMediator runs.

alt text

Is there any way for me to force a refresh of the cache as soon as the publish is completed?

Best regards Nicolai

Gravatar for slangevin@coveo.com

Comment by Simon, Feb 1, 2016 11:50 AM

There is a transaction delay indeed, but for a single item it should be a matter of seconds. Do you have the same behavior when you rebuild a single item in the Content Editor using the Developer tab >> Re-index Tree?

For a full republish, be aware that the strategy used is OnPublishEnd which will only start when the published is fully done in Sitecore.

If this slowness happens for single items, then we will need to analyze the transactions and this is more a support issue so please contact support : https://coveocommunity.force.com/s/support

Cheers,
Simon

Gravatar for nbo@oxygen.dk

Comment by nbo, Feb 4, 2016 7:19 AM

The problem exists also when indexing single items. The problem is "fixed" every time, the Cache mediator is called, refreshing the cache. This happens roughly every five minutes, but our customer wishes for this to happen immediately after publishing an item.

So I really just need a way to either refresh the cache from my C#/.net code or configure CES to refresh the cache every minute.

Best regards Nicolai

Gravatar for slangevin@coveo.com

Comment by Simon, Feb 4, 2016 9:09 AM

Hum… seems like a workaround however. Are your items secured?

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Feb 4, 2016 10:45 AM

There's unfortunately no way to programmatically trigger the commit of a transaction nor the refresh of those caches from Sitecore. Even if there was a way, timing would be an issue because items to index get processed by Sitecore after a publish is done because of the OnPublishEndAsynchronousStrategy. Even if you wait until Sitecore have processed all the items, it would mean all of them are sent in the RabbitMQ queue. You cannot know when they are all processed by CES and the transaction is ready to be committed.

The caches of Coveo Enterprise Search are refreshed after every indexing transaction commit. Transactions are committed every minute if documents were indexed in the last minute. This can be configured in the CES Administration tool (see "Transactions" in Modifying or Using Advanced Index Parameters).

I think modifying this parameter is your best option. Be warned that decreasing it too much can have a performance impact too as the index will process more smaller transactions. Processing a transaction takes time and more computing.

Gravatar for nbo@oxygen.dk

Comment by nbo, Feb 5, 2016 12:49 AM

Thank you for the great response. I'll relay this information, and then we will have to tweak the transaction commit time.

Best regards Nicolai oksen

Ask a question