|
|
@ -1276,18 +1276,9 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
return item;
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public BaseItem GetMemoryItemById(Guid id)
|
|
|
|
private bool EnableCaching
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (id == Guid.Empty)
|
|
|
|
get { return true; }
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ArgumentNullException("id");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BaseItem item;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LibraryItemsCache.TryGetValue(id, out item);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return item;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
|
|
|
|
public IEnumerable<BaseItem> GetItemList(InternalItemsQuery query)
|
|
|
@ -1297,6 +1288,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
AddUserToQuery(query, query.User);
|
|
|
|
AddUserToQuery(query, query.User);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return ItemRepository.GetItemList(query);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = ItemRepository.GetItemIdsList(query);
|
|
|
|
var result = ItemRepository.GetItemIdsList(query);
|
|
|
|
|
|
|
|
|
|
|
|
return result.Select(GetItemById).Where(i => i != null);
|
|
|
|
return result.Select(GetItemById).Where(i => i != null);
|
|
|
@ -1336,6 +1332,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
|
|
|
|
|
|
|
SetTopParentIdsOrAncestors(query, parents);
|
|
|
|
SetTopParentIdsOrAncestors(query, parents);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return ItemRepository.GetItemList(query);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return GetItemIds(query).Select(GetItemById).Where(i => i != null);
|
|
|
|
return GetItemIds(query).Select(GetItemById).Where(i => i != null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1358,6 +1359,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
|
|
|
|
|
|
|
|
if (query.EnableTotalRecordCount)
|
|
|
|
if (query.EnableTotalRecordCount)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return ItemRepository.GetItems(query);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var initialResult = ItemRepository.GetItemIds(query);
|
|
|
|
var initialResult = ItemRepository.GetItemIds(query);
|
|
|
|
|
|
|
|
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
@ -1367,6 +1373,14 @@ namespace MediaBrowser.Server.Implementations.Library
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!EnableCaching)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Items = ItemRepository.GetItemList(query).ToArray()
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
return new QueryResult<BaseItem>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Items = ItemRepository.GetItemIdsList(query).Select(GetItemById).Where(i => i != null).ToArray()
|
|
|
|
Items = ItemRepository.GetItemIdsList(query).Select(GetItemById).Where(i => i != null).ToArray()
|
|
|
|