<PackageReference Include="Microsoft.Extensions.Primitives" Version="9.0.9" />

IChangeToken

public interface IChangeToken
Propagates notifications that a change has occurred.
bool ActiveChangeCallbacks { get; }

Indicates if this token will proactively raise callbacks. If false, the token consumer must poll HasChanged to detect changes.

bool HasChanged { get; }

Gets a value that indicates if a change has occurred.

IDisposable RegisterChangeCallback(Action<object> callback, object state)

Registers for a callback that will be invoked when the entry has changed. HasChanged MUST be set before the callback is invoked.