Fixes up dictionary and language repositories to have underlying simple get repositories since they support getting by id, unique id and string variations but we want to have native repository enabled caching for these items so these get methods now use private repositories based on these keys. Adds more tests, removes N+1 queries for languages and dictionary items. Removes RuntimeCacheProvider, we only want one type of cache, this simplifies things a lot.
This commit is contained in:
@@ -8,6 +8,7 @@ using Umbraco.Core.Events;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using umbraco.interfaces;
|
||||
using System.Linq;
|
||||
|
||||
@@ -160,7 +161,7 @@ namespace Umbraco.Web.Cache
|
||||
//if there's no path, then just use id (this will occur on permanent deletion like emptying recycle bin)
|
||||
if (payload.Path.IsNullOrWhiteSpace())
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(
|
||||
string.Format("{0}_{1}", CacheKeys.MediaCacheKey, payload.Id));
|
||||
}
|
||||
else
|
||||
@@ -170,15 +171,17 @@ namespace Umbraco.Web.Cache
|
||||
int idPartAsInt;
|
||||
if (int.TryParse(idPart, out idPartAsInt))
|
||||
{
|
||||
RuntimeCacheProvider.Current.Delete(typeof(IMedia), idPartAsInt);
|
||||
//RuntimeCacheProvider.Current.Delete(typeof(IMedia), idPartAsInt);
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(
|
||||
RepositoryBase.GetCacheIdKey<IMedia>(idPartAsInt));
|
||||
}
|
||||
|
||||
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(
|
||||
string.Format("{0}_{1}_True", CacheKeys.MediaCacheKey, idPart));
|
||||
|
||||
// Also clear calls that only query this specific item!
|
||||
if (idPart == payload.Id.ToString(CultureInfo.InvariantCulture))
|
||||
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheByKeySearch(
|
||||
string.Format("{0}_{1}", CacheKeys.MediaCacheKey, payload.Id));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user