From 3ffeb751b93faa5e44d48fb4ed36b6496e3fcacf Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 14 Feb 2019 00:17:33 +1100 Subject: [PATCH] Implements GetByContentType in nucache --- .../LegacyXmlPublishedCache/PublishedContentCache.cs | 4 +++- src/Umbraco.Web/PublishedCache/IPublishedCache.cs | 3 +-- src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs index 51c6668913..e7b5a45a3a 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedContentCache.cs @@ -548,7 +548,9 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache public override IEnumerable GetByContentType(PublishedContentType contentType) { - throw new NotImplementedException(); + return GetAtRoot() + .SelectMany(x => x.DescendantsOrSelf()) + .Where(x => x.ContentType == contentType); } #endregion diff --git a/src/Umbraco.Web/PublishedCache/IPublishedCache.cs b/src/Umbraco.Web/PublishedCache/IPublishedCache.cs index 178d34cfa3..25d70b81b4 100644 --- a/src/Umbraco.Web/PublishedCache/IPublishedCache.cs +++ b/src/Umbraco.Web/PublishedCache/IPublishedCache.cs @@ -208,8 +208,7 @@ namespace Umbraco.Web.PublishedCache /// The content type, or null. /// The alias is case-insensitive. PublishedContentType GetContentType(string alias); - - // TODO: can we implement this, now? maybe only with NuCache else will throw NotImplemented... + IEnumerable GetByContentType(PublishedContentType contentType); } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs index 74cf960170..f08fa1e8e3 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs @@ -388,7 +388,9 @@ namespace Umbraco.Web.PublishedCache.NuCache public override IEnumerable GetByContentType(PublishedContentType contentType) { - throw new NotImplementedException(); + return GetAtRoot() + .SelectMany(x => x.DescendantsOrSelf()) + .Where(x => x.ContentType == contentType); } #endregion