diff --git a/README.md b/README.md index d3270d2..f11894d 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ FluentCacheKey.ForPage().OfSite("Sandbox").WithAliasPath("/home", "en-us"); FluentCacheKey.ForPages().OfSite("Sandbox").OfClassName(HomePage.CLASS_NAME); FluentCacheKey.ForPages().OfSite("Sandbox").UnderAliasPath("/home"); + +FluentCacheKey.ForPagesNodeOrder().All(); ``` ### Creating cache keys for CMS objects / custom module classes diff --git a/src/KenticoFluentCacheKeys/FluentCacheKey.cs b/src/KenticoFluentCacheKeys/FluentCacheKey.cs index e5eee2d..984cfd0 100644 --- a/src/KenticoFluentCacheKeys/FluentCacheKey.cs +++ b/src/KenticoFluentCacheKeys/FluentCacheKey.cs @@ -8,6 +8,7 @@ public interface ISitePageCacheDependencyKey string SiteName { get; } } public interface IPagesCacheDependencyKey { } + public interface IPagesNodeOrderCacheDependencyKey { } public interface ISitePagesCacheDependencyKey { string SiteName { get; } @@ -48,6 +49,7 @@ public class FluentCacheKey : IPageCacheDependencyKey, ISitePageCacheDependencyKey, IPagesCacheDependencyKey, + IPagesNodeOrderCacheDependencyKey, ISitePagesCacheDependencyKey, IObjectCacheDependencyKey, IObjectOfClassNameCacheDependencyKey, @@ -79,6 +81,13 @@ public static IPageCacheDependencyKey ForPage() => public static IPagesCacheDependencyKey ForPages() => new FluentCacheKey(null, null); + /// + /// Builds Document and Node related cache dependency keys for changes in the node order + /// + /// + public static IPagesNodeOrderCacheDependencyKey ForPagesNodeOrder() => + new FluentCacheKey(null, null); + /// /// Builds CMS Object and custom Module Class related cache dependency keys for a single object /// @@ -162,6 +171,9 @@ public static string WithNodeGuid(this ISitePageCacheDependencyKey key, Guid nod public static class PagesCacheDependencyExtensions { + public static string All(this IPagesNodeOrderCacheDependencyKey _) => + "nodeorder"; + public static ISitePagesCacheDependencyKey OfSite(this IPagesCacheDependencyKey _, string siteName) => new FluentCacheKey(null, siteName); diff --git a/tests/KenticoFluentCacheKeys.Tests/FluentCacheKeysTests.cs b/tests/KenticoFluentCacheKeys.Tests/FluentCacheKeysTests.cs index 4941ff6..926fb53 100644 --- a/tests/KenticoFluentCacheKeys.Tests/FluentCacheKeysTests.cs +++ b/tests/KenticoFluentCacheKeys.Tests/FluentCacheKeysTests.cs @@ -58,6 +58,14 @@ public void ForPages_OfSite_UnderAliasPath_Will_Create_A_Valid_Key(string siteNa key.Should().Be($"node|{siteName}|{aliasPath}|childnodes"); } + [Fact] + public void ForPagesNodeOrder_All_Will_Create_A_Valid_Key() + { + string key = FluentCacheKey.ForPagesNodeOrder().All(); + + key.Should().Be("nodeorder"); + } + [Theory, AutoData] public void ForPages_OfSite_OfClass_Will_Create_A_Valid_Key(string siteName, string className) {