2

I have 2 CD and 2 CM servers. Whenever I add version and publish it, on the frontend only showing the previous versions except I recycle pool on all CD servers or I implement Clear all cache on each server (Similiar to /sitecore/admin/cache.aspx: Clear)

I've tried clearing html cache and Rendering parameter cache but they don't solve the problem.

Also I've tried this too (on each server) but still won't help:

db.Caches.DataCache.RemoveItemInformation(item.ID);
db.Caches.DataCache.Remove(item.ID);
db.Caches.StandardValuesCache.RemoveKeysContaining(item.ID.ToString());
db.Caches.PathCache.RemoveKeysContaining(item.ID.ToString());
db.Caches.ItemCache.RemoveItem(item.ID);

The only workaround is clearing ALL cache on each server :

foreach (var cache in CacheManager.GetAllCaches())
{
    if (cache != null)
    {
        cache.Clear();
    }
}

But I think that's too expensive, right? So, which cache should I clear? (refer to caches name on /sitecore/admin/cache.aspx)

Without above code and manual clearing, everything works fine in local server, or single server

I'm using EventQueue to trigger local events on each server. Using Sitecore 8.2 Initial Release

1
  • This sounds to me like you have the remote events configured incorrectly. Sitecore clears all the caches you need on a publish, you shouldn't need to write any code to have to do that.
    – Richard Seal
    Feb 1, 2019 at 15:28

2 Answers 2

1

Basically, the only cache you need to clear is HTML and Rendering parameters cache, and usually it is configured in the config file, rather than custom event handlers. However, what I think of is that:

  1. Are you sure that the code that you are running to clear the cache is running properly? (e.g. you attach in to the right event on the right server, etc.)
  2. Is it possible that your CD environment is misconfigured? Usually, it is only a matter of enabling/disabling the config files. Please, check the list in the official sitecore documentation. (You can find a list of config files to enable/disable in the Configuring CD Server section p.5.)
1
  • 1. Yes. I added a log to check if the event is executed properly, and it did, executed on all server. That's why my clear all cache solved the problem. 2. Hmm maybe I can check that FYI I'm using custom publisher
    – purnadika
    Feb 6, 2019 at 9:14
0

Looks like your HTML cache is not getting cleared after publish in CD environments.

  • Make sure your site is configured to clear cache on publish:end and publish:end:remote events. The config should look like this:
        <event name="publish:end">
            <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
                <sites hint="list">
                    <site hint="website">website</site>
                </sites>
             </handler>
        <event>
  • If you have any custom publish:end events, verify if they are executed successfully. If one of the event is failed, It could affect all events in queue.
1
  • I'm using a custom event to do that, and it executed properly but doesn't solve the problem. Except clearing all caches
    – purnadika
    Feb 6, 2019 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.