Clear/Refresh cache on publish (Sitecore)
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.
Is there any way for me to force a refresh of the cache as soon as the publish is completed?
Best regards Nicolai
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.