The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.

JsonSerializationMixin Class

Summary

Set of extension methods associated with JSON serialization.
Namespace
Akavache
Base Types
  • object
graph BT Type-->Base0["object"] Type["JsonSerializationMixin"] class Type type-node

Syntax

public static class JsonSerializationMixin

Methods

Name Value Summary
GetAllObjects<T>(IBlobCache) IObservable<IEnumerable<T>>
Return all objects of a specific Type in the cache.
static
GetAndFetchLatest<T>(IBlobCache, string, Func<IObservable<T>>, Func<DateTimeOffset, bool>?, DateTimeOffset?, bool, Func<T, bool>?) IObservable<T>
This method attempts to returned a cached value, while simultaneously calling a Func to return the latest value. When the latest data comes back, it replaces what was previously in the cache. This method is best suited for loading dynamic data from the Internet, while still showing the user earlier data. This method returns an IObservable that may return *two* results (first the cached data, then the latest data). Therefore, it's important for UI applications that in your Subscribe method, you write the code to merge the second result when it comes in. This also means that await'ing this method is a Bad Idea(tm), always use Subscribe.
static
GetAndFetchLatest<T>(IBlobCache, string, Func<Task<T>>, Func<DateTimeOffset, bool>?, DateTimeOffset?, bool, Func<T, bool>?) IObservable<T>
This method attempts to returned a cached value, while simultaneously calling a Func to return the latest value. When the latest data comes back, it replaces what was previously in the cache. This method is best suited for loading dynamic data from the Internet, while still showing the user earlier data. This method returns an IObservable that may return *two* results (first the cached data, then the latest data). Therefore, it's important for UI applications that in your Subscribe method, you write the code to merge the second result when it comes in. This also means that awaiting this method is a Bad Idea(tm), always use Subscribe.
static
GetObject<T>(IBlobCache, string) IObservable<T>
Get an object from the cache and deserialize it via the JSON serializer.
static
GetObjectCreatedAt<T>(IBlobCache, string) IObservable<DateTimeOffset?>
Returns the time that the key was added to the cache, or returns null if the key isn't in the cache.
static
GetOrCreateObject<T>(IBlobCache, string, Func<T>, DateTimeOffset?) IObservable<T>
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.
static
GetOrFetchObject<T>(IBlobCache, string, Func<IObservable<T>>, DateTimeOffset?) IObservable<T>
Attempt to return an object from the cache. If the item doesn't exist or returns an error, call a Func to return the latest version of an object and insert the result in the cache. For most Internet applications, this method is the best method to call to fetch static data (i.e. images) from the network.
static
GetOrFetchObject<T>(IBlobCache, string, Func<Task<T>>, DateTimeOffset?) IObservable<T>
Attempt to return an object from the cache. If the item doesn't exist or returns an error, call a Func to return the latest version of an object and insert the result in the cache. For most Internet applications, this method is the best method to call to fetch static data (i.e. images) from the network.
static
InsertAllObjects<T>(IBlobCache, IDictionary<string, T>, DateTimeOffset?) IObservable<Unit>
Insert several objects into the cache, via the JSON serializer. Similarly to InsertAll, partial inserts should not happen.
static
InsertObject<T>(IBlobCache, string, T, DateTimeOffset?) IObservable<Unit>
Insert an object into the cache, via the JSON serializer.
static
InvalidateAllObjects<T>(IBlobCache) IObservable<Unit>
Invalidates all objects of the specified type. To invalidate all objects regardless of type, use InvalidateAll.
static
InvalidateObject<T>(IBlobCache, string) IObservable<Unit>
Invalidates a single object from the cache. It is important that the Type Parameter for this method be correct, and you cannot use IBlobCache.Invalidate to perform the same task.
static

Extension Methods

Name Value Summary
InvokeViewModelAction<T>(Action<T>) object
This is a thing I lifted from Prism.