Class CacheBackedRequest<TModel>
Represents a Request that is backed by a caching strategy.
public class CacheBackedRequest<TModel> : INotifyPropertyChanged where TModel : BaseModel, new()
Type Parameters
TModel
- Inheritance
-
CacheBackedRequest<TModel>
- Implements
- Inherited Members
Constructors
CacheBackedRequest(IPostgrestTableWithCache<TModel>, IPostgrestCacheProvider, Func<Task<ModeledResponse<TModel>>>)
Constructs a Cache Backed Request that automatically populates itself using the Cache provider (if possible).
public CacheBackedRequest(IPostgrestTableWithCache<TModel> instance, IPostgrestCacheProvider cacheProvider, Func<Task<ModeledResponse<TModel>>> remoteRequestAction)
Parameters
instance
IPostgrestTableWithCache<TModel>cacheProvider
IPostgrestCacheProviderremoteRequestAction
Func<Task<ModeledResponse<TModel>>>
Properties
CacheTime
The stored cache time in UTC.
public DateTime? CacheTime { get; protected set; }
Property Value
Models
The Models returned either by Cache Hit or Remote Response
public List<TModel> Models { get; set; }
Property Value
- List<TModel>
Response
The response (if applicable) from _remoteRequestAction
public ModeledResponse<TModel>? Response { get; protected set; }
Property Value
- ModeledResponse<TModel>
WasCacheHit
If the cache was hit for this request.
public bool WasCacheHit { get; protected set; }
Property Value
WasResponseCached
If the response was stored in cache.
public bool WasResponseCached { get; protected set; }
Property Value
Events
PropertyChanged
public event PropertyChangedEventHandler? PropertyChanged
Event Type
RemoteModelsPopulated
Invoked when Remote Models have been populated on this object.
public event CacheBackedRequest<TModel>.RemoteModelsPopulatedEventHandler? RemoteModelsPopulated