Files
Umbraco-CMS/src/Umbraco.PublishedCache.NuCache/CacheKeys.cs

63 lines
2.2 KiB
C#
Raw Normal View History

Published members cleanup (#10159) * Getting new netcore PublicAccessChecker in place * Adds full test coverage for PublicAccessChecker * remove PublicAccessComposer * adjust namespaces, ensure RoleManager works, separate public access controller, reduce content controller * Implements the required methods on IMemberManager, removes old migrated code * Updates routing to be able to re-route, Fixes middleware ordering ensuring endpoints are last, refactors pipeline options, adds public access middleware, ensures public access follows all hops * adds note * adds note * Cleans up ext methods, ensures that members identity is added on both front-end and back ends. updates how UmbracoApplicationBuilder works in that it explicitly starts endpoints at the time of calling. * Changes name to IUmbracoEndpointBuilder * adds note * Fixing tests, fixing error describers so there's 2x one for back office, one for members, fixes TryConvertTo, fixes login redirect * fixing build * Updates user manager to correctly validate password hashing and injects the IBackOfficeUserPasswordChecker * Merges PR * Fixes up build and notes * Implements security stamp and email confirmed for members, cleans up a bunch of repo/service level member groups stuff, shares user store code between members and users and fixes the user identity object so we arent' tracking both groups and roles. * Security stamp for members is now working * Fixes keepalive, fixes PublicAccessMiddleware to not throw, updates startup code to be more clear and removes magic that registers middleware. * adds note * removes unused filter, fixes build * fixes WebPath and tests * Looks up entities in one query * remove usings * Fix test, remove stylesheet * Set status code before we write to response to avoid error * Ensures that users and members are validated when logging in. Shares more code between users and members. * merge changes * oops * Reducing and removing published member cache * Fixes RepositoryCacheKeys to ensure the keys are normalized * oops didn't mean to commit this * Fix casing issues with caching, stop boxing value types for all cache operations, stop re-creating string keys in DefaultRepositoryCachePolicy * oops didn't mean to comit this * bah, far out this keeps getting recommitted. sorry * cannot inject IPublishedMemberCache and cannot have IPublishedMember * splits out files, fixes build * fix tests * removes membership provider classes * removes membership provider classes * updates the identity map definition * reverts commented out lines * reverts commented out lines Co-authored-by: Bjarke Berg <mail@bergmania.dk>
2021-04-22 21:21:43 +10:00
using System;
2016-05-27 14:26:28 +02:00
using System.Runtime.CompilerServices;
namespace Umbraco.Cms.Infrastructure.PublishedCache
2016-05-27 14:26:28 +02:00
{
2017-07-12 14:09:31 +02:00
internal static class CacheKeys
2016-05-27 14:26:28 +02:00
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static string DraftOrPub(bool previewing)
{
return previewing ? "D:" : "P:";
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static string LangId(string? culture)
=> string.IsNullOrEmpty(culture) ? string.Empty : ("-L:" + culture);
2016-05-27 14:26:28 +02:00
public static string PublishedContentChildren(Guid contentUid, bool previewing)
{
return "NuCache.Content.Children[" + DraftOrPub(previewing) + ":" + contentUid + "]";
}
public static string ContentCacheRoots(bool previewing)
{
return "NuCache.ContentCache.Roots[" + DraftOrPub(previewing) + "]";
}
public static string MediaCacheRoots(bool previewing)
{
return "NuCache.MediaCache.Roots[" + DraftOrPub(previewing) + "]";
}
public static string PublishedContentAsPreviewing(Guid contentUid)
{
return "NuCache.Content.AsPreviewing[" + contentUid + "]";
}
public static string ProfileName(int userId)
{
return "NuCache.Profile.Name[" + userId + "]";
}
public static string PropertyCacheValues(Guid contentUid, string typeAlias, bool previewing)
2016-05-27 14:26:28 +02:00
{
return "NuCache.Property.CacheValues[" + DraftOrPub(previewing) + contentUid + ":" + typeAlias + "]";
2016-05-27 14:26:28 +02:00
}
// routes still use int id and not Guid uid, because routable nodes must have
// a valid ID in the database at that point, whereas content and properties
// may be virtual (and not in umbracoNode).
public static string ContentCacheRouteByContent(int id, bool previewing, string? culture)
2016-05-27 14:26:28 +02:00
{
return "NuCache.ContentCache.RouteByContent[" + DraftOrPub(previewing) + id + LangId(culture) + "]";
2016-05-27 14:26:28 +02:00
}
public static string ContentCacheContentByRoute(string route, bool previewing, string? culture)
2016-05-27 14:26:28 +02:00
{
2018-04-24 14:39:52 +10:00
return "NuCache.ContentCache.ContentByRoute[" + DraftOrPub(previewing) + route + LangId(culture) + "]";
2016-05-27 14:26:28 +02:00
}
}
}