Files
Umbraco-CMS/src/Umbraco.Core/PublishedCache/Internal/InternalPublishedContentCache.cs
Elitsa Marinovska 9c18cd22e0 V14: Deleted code marked as obsolete for V14 (#15998)
* Obsoletions related to Delivery API

* Fix TypeLoader and TypeFinder tests

* Remove obsolete and default implementations of IFileSource and IFileTypeCollection

* More Delivery API related obsoletions

* VariationContextAccessor related

* ValueFactories obsoletion and fix references

* ValueSetBuilders obsoletions

* ValueConverters obsoletions

* Other obsolete ctors and methods

* Forgotten VariationContextAccessor obsoletion

* More obsoletions

* XPath related obsoletions

* Revert XmlHelper changes

* Delete RenamedRootNavigator and its tests

* Fix test

* XmlHelper obsoletion

* Return null instead of GetXPathValue

* Obsolete entire class instead

* Remove XPath obsoletions from IPublishedCache

* Remove XPath-related if-block that is no longer needed

* Change obsolete msg for classes needed for NuCache

* Moving classes to NuCache and making them internal

* Remove more XPath-related obsoletions

* Remove NavigableNavigator and its tests

* Cleanup

* Remove Xpath references from tests

* Revert interface deletion in MediaCache

* Using XOR operation

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>

---------

Co-authored-by: Nuklon <Nuklon@users.noreply.github.com>
2024-04-09 09:06:48 +02:00

53 lines
2.4 KiB
C#

using System.ComponentModel;
using Umbraco.Cms.Core.Models.PublishedContent;
namespace Umbraco.Cms.Core.PublishedCache.Internal;
// TODO: Only used in unit tests, needs to be moved to test project
[EditorBrowsable(EditorBrowsableState.Never)]
public sealed class InternalPublishedContentCache : PublishedCacheBase, IPublishedContentCache, IPublishedMediaCache
{
private readonly Dictionary<int, IPublishedContent> _content = new();
public InternalPublishedContentCache()
: base(false)
{
}
public IPublishedContent GetByRoute(bool preview, string route, bool? hideTopLevelNode = null, string? culture = null) => throw new NotImplementedException();
public IPublishedContent GetByRoute(string route, bool? hideTopLevelNode = null, string? culture = null) =>
throw new NotImplementedException();
public string GetRouteById(bool preview, int contentId, string? culture = null) =>
throw new NotImplementedException();
public string GetRouteById(int contentId, string? culture = null) => throw new NotImplementedException();
public override IPublishedContent? GetById(bool preview, int contentId) =>
_content.ContainsKey(contentId) ? _content[contentId] : null;
public override IPublishedContent GetById(bool preview, Guid contentId) => throw new NotImplementedException();
public override IPublishedContent GetById(bool preview, Udi nodeId) => throw new NotSupportedException();
public override bool HasById(bool preview, int contentId) => _content.ContainsKey(contentId);
public override IEnumerable<IPublishedContent> GetAtRoot(bool preview, string? culture = null) =>
_content.Values.Where(x => x.Parent == null);
public override bool HasContent(bool preview) => _content.Count > 0;
public override IPublishedContentType GetContentType(int id) => throw new NotImplementedException();
public override IPublishedContentType GetContentType(string alias) => throw new NotImplementedException();
public override IPublishedContentType GetContentType(Guid key) => throw new NotImplementedException();
public override IEnumerable<IPublishedContent> GetByContentType(IPublishedContentType contentType) =>
throw new NotImplementedException();
// public void Add(InternalPublishedContent content) => _content[content.Id] = content.CreateModel(Mock.Of<IPublishedModelFactory>());
public void Clear() => _content.Clear();
}