Sitecore Partial Language Fallback Cache Clearing Issue

I have been using the Sitecore Partial Language Fallback module and have faced an issue which causes a null exception during publish and the cache doesn’t clear properly on CD servers.

Today someone else faced the same issue on the sdn forums and hence decided to write a quick fix for the same

http://sdn.sitecore.net/Forum/ShowPost.aspx?PostID=60769

File to be Modified : Sitecore.SharedSource.PartialLanguageFallback/Providers/FallbackLanguageProvider.cs

Method to be modified :  ClearFallbackCaches

[sourcecode language=”csharp”]
private void ClearFallbackCaches(ItemUri itemUri, Database database)
{
var cache = _fallbackValuesCaches[database.Name];
var ignore_cache = _fallbackIgnoreCaches[database.Name];

if (cache != null)
{
// Added a null check on itemUri
if (itemUri == null)
cache.Clear();
else
cache.RemoveKeysContaining(itemUri.ItemID.ToString());
}
if (ignore_cache != null)
{
// Added a null check on itemUri
if (itemUri == null)
ignore_cache.Clear();
else
ignore_cache.RemoveKeysContaining(itemUri.ItemID.ToString());
}
}
[/sourcecode]

In the FallbackLanguageProvider class, The InitializeEventHandlers method binds the PublishEndRemoteEvent to ClearFallbackCaches with null as ItemUri.This causes the null reference exception and the caching issue.

Once we add the null reference checks before clearing the cache, Things seems to be back to normal

Should you have any questions, Please feel free to drop me a line @ sjain@horizontalintegration.com

Leave a Reply

Powered by WordPress.com.

Up ↑

%d bloggers like this: