More renaming of caches

This commit is contained in:
Stephan
2019-01-18 08:14:08 +01:00
parent 5aba1a6bd2
commit f952fe7aeb
27 changed files with 178 additions and 193 deletions

View File

@@ -35,7 +35,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
Func<int, IPublishedContent> getParent,
Func<int, XPathNavigator, IEnumerable<IPublishedContent>> getChildren,
Func<DictionaryPublishedContent, string, IPublishedProperty> getProperty,
IAppCache cacheProvider,
IAppCache appCache,
PublishedContentTypeCache contentTypeCache,
XPathNavigator nav,
bool fromExamine)
@@ -47,7 +47,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
_getParent = new Lazy<IPublishedContent>(() => getParent(ParentId));
_getChildren = new Lazy<IEnumerable<IPublishedContent>>(() => getChildren(Id, nav));
_getProperty = getProperty;
_cacheProvider = cacheProvider;
_appCache = appCache;
LoadedFromExamine = fromExamine;
@@ -133,7 +133,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
//private readonly Func<DictionaryPublishedContent, IEnumerable<IPublishedContent>> _getChildren;
private readonly Lazy<IEnumerable<IPublishedContent>> _getChildren;
private readonly Func<DictionaryPublishedContent, string, IPublishedProperty> _getProperty;
private readonly IAppCache _cacheProvider;
private readonly IAppCache _appCache;
/// <summary>
/// Returns 'Media' as the item type

View File

@@ -15,7 +15,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
{
internal class PublishedContentCache : PublishedCacheBase, IPublishedContentCache
{
private readonly IAppCache _cacheProvider;
private readonly IAppCache _appCache;
private readonly IGlobalSettings _globalSettings;
private readonly RoutesCache _routesCache;
private readonly IDomainCache _domainCache;
@@ -24,13 +24,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
// initialize a PublishedContentCache instance with
// an XmlStore containing the master xml
// an ICacheProvider that should be at request-level
// an IAppCache that should be at request-level
// a RoutesCache - need to cleanup that one
// a preview token string (or null if not previewing)
public PublishedContentCache(
XmlStore xmlStore, // an XmlStore containing the master xml
IDomainCache domainCache, // an IDomainCache implementation
IAppCache cacheProvider, // an ICacheProvider that should be at request-level
IAppCache appCache, // an IAppCache that should be at request-level
IGlobalSettings globalSettings,
ISiteDomainHelper siteDomainHelper,
PublishedContentTypeCache contentTypeCache, // a PublishedContentType cache
@@ -38,7 +38,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
string previewToken) // a preview token string (or null if not previewing)
: base(previewToken.IsNullOrWhiteSpace() == false)
{
_cacheProvider = cacheProvider;
_appCache = appCache;
_globalSettings = globalSettings;
_routesCache = routesCache; // may be null for unit-testing
_contentTypeCache = contentTypeCache;
@@ -315,13 +315,13 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
private IPublishedContent ConvertToDocument(XmlNode xmlNode, bool isPreviewing)
{
return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, _cacheProvider, _contentTypeCache);
return xmlNode == null ? null : XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache);
}
private IEnumerable<IPublishedContent> ConvertToDocuments(XmlNodeList xmlNodes, bool isPreviewing)
{
return xmlNodes.Cast<XmlNode>()
.Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, _cacheProvider, _contentTypeCache));
.Select(xmlNode => XmlPublishedContent.Get(xmlNode, isPreviewing, _appCache, _contentTypeCache));
}
#endregion
@@ -517,8 +517,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
// clear recursive properties cached by XmlPublishedContent.GetProperty
// assume that nothing else is going to cache IPublishedProperty items (else would need to do ByKeySearch)
// NOTE also clears all the media cache properties, which is OK (see media cache)
_cacheProvider.ClearOfType<IPublishedProperty>();
//_cacheProvider.ClearCacheByKeySearch("XmlPublishedCache.PublishedContentCache:RecursiveProperty-");
_appCache.ClearOfType<IPublishedProperty>();
//_appCache.ClearCacheByKeySearch("XmlPublishedCache.PublishedContentCache:RecursiveProperty-");
}
#endregion

View File

@@ -43,15 +43,15 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
private readonly IEntityXmlSerializer _entitySerializer;
// must be specified by the ctor
private readonly IAppCache _cacheProvider;
private readonly IAppCache _appCache;
public PublishedMediaCache(XmlStore xmlStore, IMediaService mediaService, IUserService userService, IAppCache cacheProvider, PublishedContentTypeCache contentTypeCache, IEntityXmlSerializer entitySerializer)
public PublishedMediaCache(XmlStore xmlStore, IMediaService mediaService, IUserService userService, IAppCache appCache, PublishedContentTypeCache contentTypeCache, IEntityXmlSerializer entitySerializer)
: base(false)
{
_mediaService = mediaService ?? throw new ArgumentNullException(nameof(mediaService));
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
_cacheProvider = cacheProvider;
_appCache = appCache;
_xmlStore = xmlStore;
_contentTypeCache = contentTypeCache;
_entitySerializer = entitySerializer;
@@ -63,16 +63,16 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
/// <param name="mediaService"></param>
/// <param name="userService"></param>
/// <param name="searchProvider"></param>
/// <param name="cacheProvider"></param>
/// <param name="appCache"></param>
/// <param name="contentTypeCache"></param>
/// <param name="entitySerializer"></param>
internal PublishedMediaCache(IMediaService mediaService, IUserService userService, ISearcher searchProvider, IAppCache cacheProvider, PublishedContentTypeCache contentTypeCache, IEntityXmlSerializer entitySerializer)
internal PublishedMediaCache(IMediaService mediaService, IUserService userService, ISearcher searchProvider, IAppCache appCache, PublishedContentTypeCache contentTypeCache, IEntityXmlSerializer entitySerializer)
: base(false)
{
_mediaService = mediaService ?? throw new ArgumentNullException(nameof(mediaService));
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
_searchProvider = searchProvider ?? throw new ArgumentNullException(nameof(searchProvider));
_cacheProvider = cacheProvider;
_appCache = appCache;
_contentTypeCache = contentTypeCache;
_entitySerializer = entitySerializer;
}
@@ -598,8 +598,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
// clear recursive properties cached by XmlPublishedContent.GetProperty
// assume that nothing else is going to cache IPublishedProperty items (else would need to do ByKeySearch)
// NOTE all properties cleared when clearing the content cache (see content cache)
//_cacheProvider.ClearCacheObjectTypes<IPublishedProperty>();
//_cacheProvider.ClearCacheByKeySearch("XmlPublishedCache.PublishedMediaCache:RecursiveProperty-");
//_appCache.ClearCacheObjectTypes<IPublishedProperty>();
//_appCache.ClearCacheByKeySearch("XmlPublishedCache.PublishedMediaCache:RecursiveProperty-");
}
#region Content types
@@ -663,7 +663,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
parentId => parentId < 0 ? null : GetUmbracoMedia(parentId),
GetChildrenMedia,
GetProperty,
_cacheProvider,
_appCache,
_contentTypeCache,
cacheValues.XPath, // though, outside of tests, that should be null
cacheValues.FromExamine
@@ -676,14 +676,14 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (_publishedMediaCacheEnabled == false)
return func(id);
var cache = Current.ApplicationCache.RuntimeCache;
var cache = Current.AppCaches.RuntimeCache;
var key = PublishedMediaCacheKey + id;
return (CacheValues)cache.Get(key, () => func(id), _publishedMediaCacheTimespan);
}
internal static void ClearCache(int id)
{
var cache = Current.ApplicationCache.RuntimeCache;
var cache = Current.AppCaches.RuntimeCache;
var sid = id.ToString();
var key = PublishedMediaCacheKey + sid;

View File

@@ -20,18 +20,18 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
[XmlType(Namespace = "http://umbraco.org/webservices/")]
internal class XmlPublishedContent : PublishedContentBase
{
private XmlPublishedContent(XmlNode xmlNode, bool isPreviewing, IAppCache cacheProvider, PublishedContentTypeCache contentTypeCache)
private XmlPublishedContent(XmlNode xmlNode, bool isPreviewing, IAppCache appCache, PublishedContentTypeCache contentTypeCache)
{
_xmlNode = xmlNode;
_isPreviewing = isPreviewing;
_cacheProvider = cacheProvider;
_appCache = appCache;
_contentTypeCache = contentTypeCache;
}
private readonly XmlNode _xmlNode;
private readonly bool _isPreviewing;
private readonly IAppCache _cacheProvider; // at snapshot/request level (see PublishedContentCache)
private readonly IAppCache _appCache; // at snapshot/request level (see PublishedContentCache)
private readonly PublishedContentTypeCache _contentTypeCache;
private readonly object _initializeLock = new object();
@@ -252,7 +252,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
if (parent == null) return;
if (parent.Attributes?.GetNamedItem("isDoc") != null)
_parent = Get(parent, _isPreviewing, _cacheProvider, _contentTypeCache);
_parent = Get(parent, _isPreviewing, _appCache, _contentTypeCache);
_parentInitialized = true;
}
@@ -409,7 +409,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
var iterator = nav.Select(expr);
_children = iterator.Cast<XPathNavigator>()
.Select(n => Get(((IHasXmlNode) n).GetNode(), _isPreviewing, _cacheProvider, _contentTypeCache))
.Select(n => Get(((IHasXmlNode) n).GetNode(), _isPreviewing, _appCache, _contentTypeCache))
.OrderBy(x => x.SortOrder)
.ToList();
@@ -440,7 +440,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
public static void ClearRequest()
{
Current.ApplicationCache.RequestCache.ClearByKey(CacheKeyPrefix);
Current.AppCaches.RequestCache.ClearByKey(CacheKeyPrefix);
}
private const string CacheKeyPrefix = "CONTENTCACHE_XMLPUBLISHEDCONTENT_";