using System.Collections.Generic; using System.Linq; using Umbraco.Web.Routing; namespace Umbraco.Web.PublishedCache.NuCache { internal class DomainCache : IDomainCache { private readonly SnapDictionary.Snapshot _snapshot; public DomainCache(SnapDictionary.Snapshot snapshot) { _snapshot = snapshot; } public IEnumerable GetAll(bool includeWildcards) { var list = _snapshot.GetAll(); if (includeWildcards == false) list = list.Where(x => x.IsWildcard == false); return list; } public IEnumerable GetAssigned(int contentId, bool includeWildcards) { // probably this could be optimized with an index // but then we'd need a custom DomainStore of some sort var list = _snapshot.GetAll(); list = list.Where(x => x.ContentId == contentId); if (includeWildcards == false) list = list.Where(x => x.IsWildcard == false); return list; } } }