> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-cms/17.latest/extend-your-project/server-side-extensions/cache/imemberpartialviewcacheinvalidator.md).

# IMemberPartialViewCacheInvalidator

This section describes the `IMemberPartialViewCacheInvalidator` interface, what it's default implementation does and how to customize it.

## What is an IMemberPartialViewCacheInvalidator?

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?

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?

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.

If no member is logged in during caching, items with an empty member marker (for example, `-m-`) are also cleared.

## Customizing the implementation

You can replace the default implementation by removing it and registering your own in a composer.

```csharp
public class ReplaceMemberCacheInvalidatorComposer : IComposer
{
    public void Compose(IUmbracoBuilder builder)
    {
        builder.Services.AddUnique<IMemberPartialViewCacheInvalidator, MyCustomMemberPartialViewCacheInvalidator>();
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.umbraco.com/umbraco-cms/17.latest/extend-your-project/server-side-extensions/cache/imemberpartialviewcacheinvalidator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
