My requirement is to run the publishing scheduler every 10 minutes and clear cache. Do we have any OOB feature, functionality in Sitecore which can be used to do it or we need to write custom job/scheduler.
-
2Publishing and clearing caches every 10 minutes is excessive for most sites and will negatively impact performance. There is almost no point in using the HTML cache if you are going to clear it that frequently. I recommend scaling this back at least a little.– Ben GoldenFeb 20, 2018 at 15:14
-
Thanks for your suggestion, what is the best and optimal time for clearing the cache and publishing– Pushpendra VatsFeb 20, 2018 at 17:00
-
Optimal depends very much on your business requirements and traffic levels, but I find that most clients don't need to publish as frequently as they think they do. Unless it is a news organization or something extremely time-sensitive, publishing a few times per day should be sufficient. Try for something in the 2-4 hour range.– Ben GoldenFeb 20, 2018 at 19:59
1 Answer
The autopublisher is an agent that is disabled by default. You will find it in the config:
<agent type="Sitecore.Tasks.PublishAgent" method="Run" interval="00:00:00">
<param desc="source database">master</param>
<param desc="target database">web</param>
<param desc="mode (full or smart or incremental)">incremental</param>
<param desc="languages">en, da</param>
</agent>
Patch the values to set it as you need. You need to change the interval (00:00:00 is disabled) to your needs (also take into account the scheduling frequency) and set the languages. For 10 minutes, the interval is 00:10:00
.
This agent will perform an incremental publish at the defined interval - don't do it too frequent as it might have a performance hit (cache clear) - and (un)publish the items that have passed their publish dates.
You might also need to check the scheduling frequency. More info on that in this post: http://sitecoreblog.alexshyba.com/sitecore_scheduling_explained/
The Sitecore Scheduler is basically a background process that is started with the sleep interval defined in the section
Within the execution of the Scheduler, it queries the inner contents for the agents defined there and adds to the queue only those agents which marked as "due". An agent is considered "due" if the value of the "interval" parameter is less than the timeframe of the last execution.