From 87efc581f7ef27a4e150667c46877a50963982ce Mon Sep 17 00:00:00 2001 From: Migaroez Date: Mon, 2 Jun 2025 15:47:00 +0200 Subject: [PATCH 01/20] Added docs around IMemberPartialViewCacheInvalidator --- .../imemberpartialviewcacheinvalidator.md | 35 +++++++++++++++++++ .../imemberpartialviewcacheinvalidator.md | 35 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md create mode 100644 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md diff --git a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md new file mode 100644 index 00000000000..98b1d31ea5b --- /dev/null +++ b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -0,0 +1,35 @@ +# ICacheRefresher + +This section describes what IMemberPartialViewCacheInvalidator is, what it's default implementation does and how to customize it. + +## What is an IMemberPartialViewCacheInvalidator + +This interface is used to isolate the logic that needs to run to invalidate parts of the PartialView cache when a member is updated + +## Why do we need to partialy invalidate the partialView cache + +Since some of the razor templates might show data that is retrieved from a member object and those templates might be cached by using the partial caching mechanism (i.e. `@await Html.CachedPartialAsync("member",Model,TimeSpan.FromDays(1), cacheByMember:true)`), we need to remove those cached partials when a member is updated. + +## Where is it used + +This interface is called from the MemberCacheRefresher which is called every time a member is updated. + +## Details of the implementation + +When a razor template partial is cached trough `Html.CachedPartialAsync` and `cacheByMember` is set to `true`, the extension method will append the memberId of the currently logged in member and a marker (i.e. `-m1015-`) to the partialView chachekey. +When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. +Since it is possible to call the `Html.CachedPartialAsync` with `cacheByMember` set to `true` while there is no member logged in, it will also clear all cache items with an empty member marker (i.e. `-m-`) + +## Customizing the implementation + +You can replace the default implementation like usual by removing the default and registering your own in a composer. + +```csharp +public class ReplaceMemberCacheInvalidatorComposer : IComposer +{ + public void Compose(IUmbracoBuilder builder) + { + builder.Services.AddUnique(); + } +} +``` diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md new file mode 100644 index 00000000000..98b1d31ea5b --- /dev/null +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -0,0 +1,35 @@ +# ICacheRefresher + +This section describes what IMemberPartialViewCacheInvalidator is, what it's default implementation does and how to customize it. + +## What is an IMemberPartialViewCacheInvalidator + +This interface is used to isolate the logic that needs to run to invalidate parts of the PartialView cache when a member is updated + +## Why do we need to partialy invalidate the partialView cache + +Since some of the razor templates might show data that is retrieved from a member object and those templates might be cached by using the partial caching mechanism (i.e. `@await Html.CachedPartialAsync("member",Model,TimeSpan.FromDays(1), cacheByMember:true)`), we need to remove those cached partials when a member is updated. + +## Where is it used + +This interface is called from the MemberCacheRefresher which is called every time a member is updated. + +## Details of the implementation + +When a razor template partial is cached trough `Html.CachedPartialAsync` and `cacheByMember` is set to `true`, the extension method will append the memberId of the currently logged in member and a marker (i.e. `-m1015-`) to the partialView chachekey. +When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. +Since it is possible to call the `Html.CachedPartialAsync` with `cacheByMember` set to `true` while there is no member logged in, it will also clear all cache items with an empty member marker (i.e. `-m-`) + +## Customizing the implementation + +You can replace the default implementation like usual by removing the default and registering your own in a composer. + +```csharp +public class ReplaceMemberCacheInvalidatorComposer : IComposer +{ + public void Compose(IUmbracoBuilder builder) + { + builder.Services.AddUnique(); + } +} +``` From da2192f173e0143c5c800c601bb13a068dc36e17 Mon Sep 17 00:00:00 2001 From: Sven Geusens Date: Mon, 14 Jul 2025 18:10:16 +0200 Subject: [PATCH 02/20] Apply suggestions from code review Co-authored-by: Andy Butland --- .../imemberpartialviewcacheinvalidator.md | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 98b1d31ea5b..4b275d042ff 100644 --- a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -1,28 +1,31 @@ -# ICacheRefresher +# Partial view cache refresher for members -This section describes what IMemberPartialViewCacheInvalidator is, what it's default implementation does and how to customize it. +This section describes the `IMemberPartialViewCacheInvalidator` interface, what it's default implementation does and how to customize it. -## What is an IMemberPartialViewCacheInvalidator +## What is an IMemberPartialViewCacheInvalidator? -This interface is used to isolate the logic that needs to run to invalidate parts of the PartialView cache when a member is updated +This interface is used to isolate the logic that invalidates parts of the partial view cache when a member is updated. -## Why do we need to partialy invalidate the partialView cache +## Why do we need to partially invalidate the partial view cache? -Since some of the razor templates might show data that is retrieved from a member object and those templates might be cached by using the partial caching mechanism (i.e. `@await Html.CachedPartialAsync("member",Model,TimeSpan.FromDays(1), cacheByMember:true)`), we need to remove those cached partials when a member is updated. +Razor templates showing data retrieved from a member object can be cached as partial views via: -## Where is it used -This interface is called from the MemberCacheRefresher which is called every time a member is updated. +## Where is it used? -## Details of the implementation +This interface is called from the member cache refresher (`MemberCacheRefresher`) which is invoked every time a member is updated. + +## Details of the default implementation + +Razor template partials are cached through a call to `Html.CachedPartialAsync` with `cacheByMember` set to `true`. This will append the id of the currently logged in member with a marker to the partial view cache key. For example, `-m1015-`. + +When the `ClearPartialViewCacheItems` method is called it will clear all cache items that match the marker for the updated members. -When a razor template partial is cached trough `Html.CachedPartialAsync` and `cacheByMember` is set to `true`, the extension method will append the memberId of the currently logged in member and a marker (i.e. `-m1015-`) to the partialView chachekey. -When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. Since it is possible to call the `Html.CachedPartialAsync` with `cacheByMember` set to `true` while there is no member logged in, it will also clear all cache items with an empty member marker (i.e. `-m-`) ## Customizing the implementation -You can replace the default implementation like usual by removing the default and registering your own in a composer. +You can replace the default implementation by removing it and registering your own in a composer. ```csharp public class ReplaceMemberCacheInvalidatorComposer : IComposer From ab385dab47843f6b1be6b4c58cf1a90e3235430b Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:46:19 +0200 Subject: [PATCH 03/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 98b1d31ea5b..9374bea350b 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -8,7 +8,7 @@ This interface is used to isolate the logic that needs to run to invalidate part ## Why do we need to partialy invalidate the partialView cache -Since some of the razor templates might show data that is retrieved from a member object and those templates might be cached by using the partial caching mechanism (i.e. `@await Html.CachedPartialAsync("member",Model,TimeSpan.FromDays(1), cacheByMember:true)`), we need to remove those cached partials when a member is updated. +Razor templates may show data that is retrieved from a member object. Those templates might be cached by using the partial caching mechanism (for example, `@await Html.CachedPartialAsync("member",Model,TimeSpan.FromDays(1), cacheByMember:true)`). When a member is updated, these cached partials must be invalidated to ensure updated data is shown. ## Where is it used From a40939d6fca49f96d301c754c51e0b42095e5dd6 Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:46:27 +0200 Subject: [PATCH 04/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 9374bea350b..7627e63671d 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -16,7 +16,7 @@ This interface is called from the MemberCacheRefresher which is called every tim ## Details of the implementation -When a razor template partial is cached trough `Html.CachedPartialAsync` and `cacheByMember` is set to `true`, the extension method will append the memberId of the currently logged in member and a marker (i.e. `-m1015-`) to the partialView chachekey. +When a razor template partial is cached through `Html.CachedPartialAsync` with `cacheByMember` set to `true`, the extension method modifies the cache key. It appends the member ID of the currently logged-in member and a marker (for example, `-m1015-`) to the partial view cache key. When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. Since it is possible to call the `Html.CachedPartialAsync` with `cacheByMember` set to `true` while there is no member logged in, it will also clear all cache items with an empty member marker (i.e. `-m-`) From 216b0b419b8d61debd4423e6115f7b434861760a Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:46:34 +0200 Subject: [PATCH 05/20] Update 13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 4b275d042ff..d01ac6fae44 100644 --- a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -21,7 +21,7 @@ Razor template partials are cached through a call to `Html.CachedPartialAsync` w When the `ClearPartialViewCacheItems` method is called it will clear all cache items that match the marker for the updated members. -Since it is possible to call the `Html.CachedPartialAsync` with `cacheByMember` set to `true` while there is no member logged in, it will also clear all cache items with an empty member marker (i.e. `-m-`) +If no member is logged in during caching, items with an empty member marker (for example, `-m-`) are also cleared. ## Customizing the implementation From 4a948d251dff818c3301521398c44bf472cda37d Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:46:40 +0200 Subject: [PATCH 06/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 7627e63671d..1d19e370cd7 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -18,7 +18,7 @@ This interface is called from the MemberCacheRefresher which is called every tim When a razor template partial is cached through `Html.CachedPartialAsync` with `cacheByMember` set to `true`, the extension method modifies the cache key. It appends the member ID of the currently logged-in member and a marker (for example, `-m1015-`) to the partial view cache key. When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. -Since it is possible to call the `Html.CachedPartialAsync` with `cacheByMember` set to `true` while there is no member logged in, it will also clear all cache items with an empty member marker (i.e. `-m-`) +If no member is logged in during caching, items with an empty member marker (for example, `-m-`) are also cleared. ## Customizing the implementation From 5f6d278a29ab1dce18cbdbcee5b0b7d0351f7b3d Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:55:07 +0200 Subject: [PATCH 07/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 1d19e370cd7..e435cc945a0 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -2,7 +2,7 @@ This section describes what IMemberPartialViewCacheInvalidator is, what it's default implementation does and how to customize it. -## What is an IMemberPartialViewCacheInvalidator +## What is an IMemberPartialViewCacheInvalidator? This interface is used to isolate the logic that needs to run to invalidate parts of the PartialView cache when a member is updated From 3d0cc017c90d498a556037069248ea6505f7858b Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:55:15 +0200 Subject: [PATCH 08/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index e435cc945a0..2f4d4986702 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -6,7 +6,7 @@ This section describes what IMemberPartialViewCacheInvalidator is, what it's def This interface is used to isolate the logic that needs to run to invalidate parts of the PartialView cache when a member is updated -## Why do we need to partialy invalidate the partialView cache +## Why do we need to partially invalidate the partial view cache? Razor templates may show data that is retrieved from a member object. Those templates might be cached by using the partial caching mechanism (for example, `@await Html.CachedPartialAsync("member",Model,TimeSpan.FromDays(1), cacheByMember:true)`). When a member is updated, these cached partials must be invalidated to ensure updated data is shown. From bbf9c18138fd5590be83d50ca31e2078383120aa Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:55:23 +0200 Subject: [PATCH 09/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 2f4d4986702..a0d3cbfaa39 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -10,7 +10,7 @@ This interface is used to isolate the logic that needs to run to invalidate part Razor templates may show data that is retrieved from a member object. Those templates might be cached by using the partial caching mechanism (for example, `@await Html.CachedPartialAsync("member",Model,TimeSpan.FromDays(1), cacheByMember:true)`). When a member is updated, these cached partials must be invalidated to ensure updated data is shown. -## Where is it used +## Where is it used? This interface is called from the MemberCacheRefresher which is called every time a member is updated. From 97ceb8df2acf047f0e3674b1b41564606a43d6fe Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:55:30 +0200 Subject: [PATCH 10/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index a0d3cbfaa39..8d58ab8b14c 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -14,7 +14,7 @@ Razor templates may show data that is retrieved from a member object. Those temp This interface is called from the MemberCacheRefresher which is called every time a member is updated. -## Details of the implementation +## Details of the default implementation When a razor template partial is cached through `Html.CachedPartialAsync` with `cacheByMember` set to `true`, the extension method modifies the cache key. It appends the member ID of the currently logged-in member and a marker (for example, `-m1015-`) to the partial view cache key. When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. From 6119a075e086146706e9ea40c12428b30ac089cf Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:55:39 +0200 Subject: [PATCH 11/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 8d58ab8b14c..fd67d2131af 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -1,4 +1,4 @@ -# ICacheRefresher +# Partial view cache refresher for members This section describes what IMemberPartialViewCacheInvalidator is, what it's default implementation does and how to customize it. From c7175d0cf01943a734b3786ae405e53888e9a144 Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:56:02 +0200 Subject: [PATCH 12/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index fd67d2131af..33865189883 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -1,6 +1,6 @@ # Partial view cache refresher for members -This section describes what IMemberPartialViewCacheInvalidator is, what it's default implementation does and how to customize it. +This section describes the `IMemberPartialViewCacheInvalidator` interface, what it's default implementation does and how to customize it. ## What is an IMemberPartialViewCacheInvalidator? From 837ec7d9f815a360f894bb3667f9c14c50b60591 Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:56:12 +0200 Subject: [PATCH 13/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 33865189883..4e5a5711a97 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -4,7 +4,7 @@ This section describes the `IMemberPartialViewCacheInvalidator` interface, what ## What is an IMemberPartialViewCacheInvalidator? -This interface is used to isolate the logic that needs to run to invalidate parts of the PartialView cache when a member is updated +This interface is used to isolate the logic that invalidates parts of the partial view cache when a member is updated. ## Why do we need to partially invalidate the partial view cache? From e90fc5ca9e529ae736fb8fefa2a9fb8f72b81e7e Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:56:22 +0200 Subject: [PATCH 14/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 4e5a5711a97..ae697e99b2a 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -12,7 +12,7 @@ Razor templates may show data that is retrieved from a member object. Those temp ## Where is it used? -This interface is called from the MemberCacheRefresher which is called every time a member is updated. +This interface is called from the member cache refresher (`MemberCacheRefresher`), which is invoked every time a member is updated. ## Details of the default implementation From 333086a8ed5b7a4b777d64045feeba738c49f7a3 Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:56:32 +0200 Subject: [PATCH 15/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index ae697e99b2a..8c0ac3d2b5f 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -16,7 +16,7 @@ This interface is called from the member cache refresher (`MemberCacheRefresher` ## Details of the default implementation -When a razor template partial is cached through `Html.CachedPartialAsync` with `cacheByMember` set to `true`, the extension method modifies the cache key. It appends the member ID of the currently logged-in member and a marker (for example, `-m1015-`) to the partial view cache key. +Razor template partials are cached through a call to `Html.CachedPartialAsync` with `cacheByMember` set to `true`. This will append the ID of the currently logged-in member with a marker to the partial view cache key. For example, `-m1015-`. When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. If no member is logged in during caching, items with an empty member marker (for example, `-m-`) are also cleared. From 6ee05bf7660591603f11a2aea817ed2870586b8c Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:57:03 +0200 Subject: [PATCH 16/20] Update 13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index d01ac6fae44..c2b63e26769 100644 --- a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -17,7 +17,7 @@ This interface is called from the member cache refresher (`MemberCacheRefresher` ## Details of the default implementation -Razor template partials are cached through a call to `Html.CachedPartialAsync` with `cacheByMember` set to `true`. This will append the id of the currently logged in member with a marker to the partial view cache key. For example, `-m1015-`. +Razor template partials are cached through a call to `Html.CachedPartialAsync` with `cacheByMember` set to `true`. This will append the ID of the currently logged-in member with a marker to the partial view cache key. For example, `-m1015-`. When the `ClearPartialViewCacheItems` method is called it will clear all cache items that match the marker for the updated members. From c7b5fd1c43f0d5460479512744b062d4bcc752cd Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:57:10 +0200 Subject: [PATCH 17/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 8c0ac3d2b5f..ba1b62fb767 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -17,7 +17,8 @@ This interface is called from the member cache refresher (`MemberCacheRefresher` ## Details of the default implementation Razor template partials are cached through a call to `Html.CachedPartialAsync` with `cacheByMember` set to `true`. This will append the ID of the currently logged-in member with a marker to the partial view cache key. For example, `-m1015-`. -When the `ClearPartialViewCacheItems` method is called it will clear all PartialView cacheItems that have the memberId marker for all passed in members. +When the `ClearPartialViewCacheItems` method is called it will clear all cache items that match the marker for the updated members. + If no member is logged in during caching, items with an empty member marker (for example, `-m-`) are also cleared. ## Customizing the implementation From 39386f5309a1f6466554f97f4d6e95492e77420d Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:57:17 +0200 Subject: [PATCH 18/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index ba1b62fb767..9ef21358416 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -23,7 +23,7 @@ If no member is logged in during caching, items with an empty member marker (for ## Customizing the implementation -You can replace the default implementation like usual by removing the default and registering your own in a composer. +You can replace the default implementation by removing it and registering your own in a composer. ```csharp public class ReplaceMemberCacheInvalidatorComposer : IComposer From 2b0458942dccfb6fb3c70dbd1b247f30ce2d18ce Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:57:26 +0200 Subject: [PATCH 19/20] Update 13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index c2b63e26769..d6652d053d3 100644 --- a/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/13/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -13,7 +13,7 @@ Razor templates showing data retrieved from a member object can be cached as par ## Where is it used? -This interface is called from the member cache refresher (`MemberCacheRefresher`) which is invoked every time a member is updated. +This interface is called from the member cache refresher (`MemberCacheRefresher`), which is invoked every time a member is updated. ## Details of the default implementation From 14f0e0e2a400752067b4521f3d7e0c6e2f78ef3b Mon Sep 17 00:00:00 2001 From: Esha Noronha <82437098+eshanrnh@users.noreply.github.com> Date: Tue, 15 Jul 2025 09:59:10 +0200 Subject: [PATCH 20/20] Update 16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md --- .../reference/cache/imemberpartialviewcacheinvalidator.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md index 9ef21358416..42e4b184c79 100644 --- a/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md +++ b/16/umbraco-cms/reference/cache/imemberpartialviewcacheinvalidator.md @@ -17,7 +17,8 @@ This interface is called from the member cache refresher (`MemberCacheRefresher` ## Details of the default implementation Razor template partials are cached through a call to `Html.CachedPartialAsync` with `cacheByMember` set to `true`. This will append the ID of the currently logged-in member with a marker to the partial view cache key. For example, `-m1015-`. -When the `ClearPartialViewCacheItems` method is called it will clear all cache items that match the marker for the updated members. + +When the `ClearPartialViewCacheItems` method is called, it will clear all cache items that match the marker for the updated members. If no member is logged in during caching, items with an empty member marker (for example, `-m-`) are also cleared.