Struct ReadPolicy
For a cache entry containing entity rows of the given type and age, decide whether it's up-to-date.
public readonly struct ReadPolicy
- Inherited Members
Properties
Conservative
All cache entries are considered stale and will be revalidated.
public static ReadPolicy Conservative { get; }
Property Value
Remarks
Useful for applications which expect a lot of data churn. May reduce both performance and UI stability.
Server
All cache entries are considered fresh and will not be revalidated.
public static ReadPolicy Server { get; }
Property Value
Remarks
For servers which use a new, isolated cache for each HTTP request, where entries only ever refer back to data loaded within the same request. Not suitable for a cache shared between requests or circuits - entries would never expire; use SharedClient(TimeSpan, TimeSpan) there.
Methods
Client(TimeSpan)
Reference data is considered fresh.
Master data is considered stale after leeway.
public static ReadPolicy Client(TimeSpan leeway)
Parameters
leewayTimeSpan
Returns
Remarks
Blazor is a "client" in this sense, but InteractiveServer should use SharedClient(TimeSpan, TimeSpan). The default leeway period is five minutes.
Custom(ReadDetermination)
Application-specific state determination.
public static ReadPolicy Custom(ReadDetermination func)
Parameters
funcReadDetermination
Returns
SharedClient(TimeSpan, TimeSpan)
Master data is considered stale after leeway.
Reference data is considered stale after referenceLeeway.
public static ReadPolicy SharedClient(TimeSpan leeway, TimeSpan referenceLeeway)
Parameters
Returns
Remarks
For framework instances sharing a cache with other principals or circuits (e.g. Blazor Server). Unlike Client(TimeSpan), reference data is not fresh indefinitely.
Operators
implicit operator ReadPolicy(ReadDetermination)
public static implicit operator ReadPolicy(ReadDetermination func)
Parameters
funcReadDetermination