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
Servers use a new instance of the framework for each HTTP request. The assumption is that we don't care about data which changes during the request. If we do care, caching should be disabled entirely using WritePolicy.
Methods
Client(TimeSpan)
Reference data is considered fresh. Master data is considered stale until a leeway period has ended.
public static ReadPolicy Client(TimeSpan leeway)
Parameters
leewayTimeSpan
Returns
Remarks
Both Blazor Server and Blazor WebAssembly are a "client" in this sense, although Blazor Server cache size should be strictly limited. The default leeway period is five minutes.
Custom(Func<IEntityInfo, TimeSpan, ReadOutcome>)
Application-specific state determination.
public static ReadPolicy Custom(Func<IEntityInfo, TimeSpan, ReadOutcome> func)
Parameters
funcFunc<IEntityInfo, TimeSpan, ReadOutcome>
Returns
Operators
implicit operator ReadPolicy(Func<IEntityInfo, TimeSpan, ReadOutcome>)
public static implicit operator ReadPolicy(Func<IEntityInfo, TimeSpan, ReadOutcome> func)
Parameters
funcFunc<IEntityInfo, TimeSpan, ReadOutcome>