SerializerExtensions.GetOrCreateObject(IBlobCache, string, Func) method¶
Defined in
Type: SerializerExtensions
Namespace: ReactiveMarbles.CacheDatabase.Core
Assembly: ReactiveMarbles.CacheDatabase.Core.dll
Applies to
netstandard2.0
public static IObservable<T?> GetOrCreateObject<T>(this IBlobCache blobCache, string key, Func<T> fetchFunc)
Summary: Attempt to return an object from the cache. If the item doesn't exist or returns an error, call a Func to create a new one.
For most Internet applications, this method is the best method to call to fetch static data (i.e. images) from the network.
Type parameters
| Name | Description |
|---|---|
T | The type of item to get. |
Parameters
| Name | Type | Description |
|---|---|---|
blobCache | [IBlobCache](# | The cache to get the item. |
key | string | The key to associate with the object. |
fetchFunc | Func | A Func which will return the latest value for the object should the cache not contain the key. |
Returns: IObservable