public string GetRouteById(bool preview, int contentId, string culture = null) { var cache = (preview == false || PublishedSnapshotService.FullCacheWhenPreviewing) ? _elementsCache : _snapshotCache; var key = CacheKeys.ContentCacheRouteByContent(contentId, preview, culture); return(cache.GetCacheItem <string>(key, () => GetRouteByIdInternal(preview, contentId, null, culture))); }
private string GetProfileNameById(int id) { var cache = GetCurrentSnapshotCache(); return(cache == null ? GetProfileNameByIdNoCache(id) : (string)cache.Get(CacheKeys.ProfileName(id), () => GetProfileNameByIdNoCache(id))); }
public IPublishedContent /*IPublishedMember*/ GetByUsername(string username) { return(GetCacheItem(CacheKeys.MemberCacheMember("ByUsername", _previewDefault, username), () => { EnsureProvider(); var member = _memberService.GetByUsername(username); return member == null ? null : GetById(member, _previewDefault); })); }
public IPublishedContent /*IPublishedMember*/ GetByProviderKey(object key) { return(GetCacheItem(CacheKeys.MemberCacheMember("ByProviderKey", _previewDefault, key), () => { EnsureProvider(); var member = _memberService.GetByProviderKey(key); return member == null ? null : GetById(member, _previewDefault); })); }
public IPublishedContent /*IPublishedMember*/ GetByEmail(string email) { return(GetCacheItem(CacheKeys.MemberCacheMember("ByEmail", _previewDefault, email), () => { EnsureProvider(); var member = _memberService.GetByEmail(email); return member == null ? null : GetById(member, _previewDefault); })); }
public IPublishedContent /*IPublishedMember*/ GetById(int memberId) { return(GetCacheItem(CacheKeys.MemberCacheMember("ById", _previewDefault, memberId), () => { EnsureProvider(); var member = _memberService.GetById(memberId); return member == null ? null : PublishedMember.Create(member, GetContentType(member.ContentTypeId), _previewDefault, _publishedSnapshotAccessor, VariationContextAccessor, _umbracoContextAccessor); })); }
public IPublishedContent GetByRoute(bool preview, string route, bool?hideTopLevelNode = null, string culture = null) { if (route == null) { throw new ArgumentNullException(nameof(route)); } var cache = preview == false || PublishedSnapshotService.FullCacheWhenPreviewing ? _elementsCache : _snapshotCache; var key = CacheKeys.ContentCacheContentByRoute(route, preview, culture); return(cache.GetCacheItem <IPublishedContent>(key, () => GetByRouteInternal(preview, route, hideTopLevelNode, culture))); }
public override IEnumerable <IPublishedContent> GetAtRoot(bool preview) { if (PublishedSnapshotService.CacheContentCacheRoots == false) { return(GetAtRootNoCache(preview)); } var cache = preview == false || PublishedSnapshotService.FullCacheWhenPreviewing ? _elementsCache : _snapshotCache; if (cache == null) { return(GetAtRootNoCache(preview)); } // note: ToArray is important here, we want to cache the result, not the function! return((IEnumerable <IPublishedContent>)cache.Get( CacheKeys.ContentCacheRoots(preview), () => GetAtRootNoCache(preview).ToArray())); }
private IPublishedContent /*IPublishedMember*/ GetById(IMember member, bool previewing) { return(GetCacheItem(CacheKeys.MemberCacheMember("ById", _previewDefault, member.Id), () => PublishedMember.Create(member, GetContentType(member.ContentTypeId), previewing, _publishedSnapshotAccessor, VariationContextAccessor, _umbracoContextAccessor))); }