Fixes FullDataSetRepositoryCachePolicy so that whenever Ids are requested, it retrieves all of the items and then post filters - ensuring there's no additional trips to the database. Fixes MemberTypeRepository so that calls to PerformGet(int) are wrapping the GetAll() call.

This commit is contained in:
Shannon
2016-01-27 18:51:37 +01:00
parent 49fc068b38
commit 02b74a5059
2 changed files with 22 additions and 35 deletions

View File

@@ -30,6 +30,20 @@ namespace Umbraco.Core.Cache
private bool? _hasZeroCountCache;
public override TEntity[] GetAll(TId[] ids, Func<TId[], IEnumerable<TEntity>> getFromRepo)
{
//process the base logic without any Ids - we want to cache them all!
var result = base.GetAll(new TId[] { }, getFromRepo);
//now that the base result has been calculated, they will all be cached.
// Now we can just filter by ids if they have been supplied
return ids.Any()
? result.Where(x => ids.Contains((TId) (object) x.Id)).ToArray()
: result;
}
/// <summary>
/// For this type of caching policy, we don't cache individual items
/// </summary>