Add the current culture to the cache key used for the CachedPartial Html Helper
when using variants it's unlikely to need the same Html.Partial to be cached across all language variations, if we always add the current culture name to the cache key, we ensure this doesn't accidentally happen, and when not using variants, no harm to have the culture for the single site included here
This commit is contained in:
committed by
Sebastiaan Janssen
parent
9f9cd0e11e
commit
6b5e19fcf2
@@ -83,6 +83,12 @@ namespace Umbraco.Web
|
||||
Func<object, ViewDataDictionary, string> contextualKeyBuilder = null)
|
||||
{
|
||||
var cacheKey = new StringBuilder(partialViewName);
|
||||
//let's always cache by the current culture to allow variants to have different cache results
|
||||
var cultureName = System.Threading.Thread.CurrentThread.CurrentUICulture.Name;
|
||||
if (!String.IsNullOrEmpty(cultureName))
|
||||
{
|
||||
cacheKey.AppendFormat("{0}-", cultureName);
|
||||
}
|
||||
if (cacheByPage)
|
||||
{
|
||||
if (Current.UmbracoContext == null)
|
||||
|
||||
Reference in New Issue
Block a user