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:
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Web.Script.Serialization;
|
||||
using umbraco;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Models;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Persistence.Caching;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Core.Sync;
|
||||
|
||||
namespace Umbraco.Web.Cache
|
||||
@@ -75,34 +77,39 @@ namespace Umbraco.Web.Cache
|
||||
|
||||
public override void RefreshAll()
|
||||
{
|
||||
RuntimeCacheProvider.Current.Clear(typeof(IContent));
|
||||
//RuntimeCacheProvider.Current.Clear(typeof(IContent));
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheObjectTypes<IContent>();
|
||||
base.RefreshAll();
|
||||
}
|
||||
|
||||
public override void Refresh(int id)
|
||||
{
|
||||
RuntimeCacheProvider.Current.Delete(typeof(IContent), id);
|
||||
//RuntimeCacheProvider.Current.Delete(typeof(IContent), id);
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(id));
|
||||
content.Instance.UpdateSortOrder(id);
|
||||
base.Refresh(id);
|
||||
}
|
||||
|
||||
public override void Remove(int id)
|
||||
{
|
||||
RuntimeCacheProvider.Current.Delete(typeof(IContent), id);
|
||||
//RuntimeCacheProvider.Current.Delete(typeof(IContent), id);
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(id));
|
||||
base.Remove(id);
|
||||
}
|
||||
|
||||
|
||||
public override void Refresh(IContent instance)
|
||||
{
|
||||
RuntimeCacheProvider.Current.Delete(typeof(IContent), instance.Id);
|
||||
//RuntimeCacheProvider.Current.Delete(typeof(IContent), instance.Id);
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(instance.Id));
|
||||
content.Instance.UpdateSortOrder(instance);
|
||||
base.Refresh(instance);
|
||||
}
|
||||
|
||||
public override void Remove(IContent instance)
|
||||
{
|
||||
RuntimeCacheProvider.Current.Delete(typeof(IContent), instance.Id);
|
||||
//RuntimeCacheProvider.Current.Delete(typeof(IContent), instance.Id);
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(instance.Id));
|
||||
base.Remove(instance);
|
||||
}
|
||||
|
||||
@@ -114,7 +121,8 @@ namespace Umbraco.Web.Cache
|
||||
{
|
||||
foreach (var payload in DeserializeFromJsonPayload(jsonPayload))
|
||||
{
|
||||
RuntimeCacheProvider.Current.Delete(typeof(IContent), payload.Id);
|
||||
//RuntimeCacheProvider.Current.Delete(typeof(IContent), payload.Id);
|
||||
ApplicationContext.Current.ApplicationCache.RuntimeCache.ClearCacheItem(RepositoryBase.GetCacheIdKey<IContent>(payload.Id));
|
||||
content.Instance.UpdateSortOrder(payload.Id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user