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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user