Fixes a cache null ref issue in ClearCacheItem (patch by Sir Stéphane Gay)

This commit is contained in:
hartvig
2012-01-10 10:59:03 -01:00
parent 6f5f7a7be5
commit 2e916e252c
2 changed files with 12 additions and 8 deletions

View File

@@ -31,14 +31,18 @@ namespace umbraco.cms.businesslogic.cache
/// <summary>
/// Clears the item in umbraco's runtime cache with the given key
/// </summary>
/// <param name="Key">Key</param>
public static void ClearCacheItem(string Key)
/// <param name="key">Key</param>
public static void ClearCacheItem(string key)
{
if (System.Web.HttpRuntime.Cache[Key] != null)
{
HttpRuntime.Cache.Remove(Key);
HttpContext.Current.Trace.Warn("Cache", "Item " + Key + " removed from cache");
}
// NH 10 jan 2012
// Patch by the always wonderful Stéphane Gay to avoid cache null refs
var cache = HttpRuntime.Cache;
if (cache[key] != null)
{
var context = HttpContext.Current;
if (context != null)
context.Trace.Warn("Cache", "Item " + key + " removed from cache");
}
}

View File

@@ -40,7 +40,7 @@
<ExamineLuceneIndexSets configSource="config\ExamineIndex.config" />
<appSettings>
<add key="umbracoDbDSN" value="server=.\sqlexpress;database=v47;integrated security=false;user id=DBUSER;password=DBPASSWORD" />
<add key="umbracoConfigurationStatus" value="4.7.1.1" />
<add key="umbracoConfigurationStatus" value="4.7.1" />
<add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd" />
<add key="umbracoReservedPaths" value="~/umbraco,~/install/" />
<add key="umbracoContentXML" value="~/App_Data/umbraco.config" />