Could not find Akavache GetObjectAsync method

164 Views Asked by At

I've installed akavache Nuget package (tried v5.0 and v6.0.0-alpha and I am using .NET Standard), but don't have access to GetObjectAsync mentioned in many examples through the web. (Even on the official page).

I am considering this is rather not Akavache's methods but Rx extensions or something, but could not find if (and where) I can use it.

For instance, BlobCache.UserAccount just doesn't have it and I am shown syntax error.

Any clue?

1

There are 1 best solutions below

1
On BEST ANSWER

GetObjectAsync was removed from Akavache because System.Reactive provides the means to convert an Observable in to a Task. In fact, an Observable can even be awaited.

GetObject returns an IObservable and can be used in place of GetObjectAsync, so long as the System.Reactive.Linq namespace is imported.

var obj = await BlobCache.UserAccount.GetObjectAsync("toaster"); // old style
var obj = await BlobCache.UserAccount.GetObject("toaster"); // new style

Note: An awaited Observable is expected to OnNext a single value only. If OnNext is invoked 2 or more times, or not at all, an exception will be thrown. OnError will also cause an exception to be thrown.

The documentation has been updated to exclude GetObjectAsync as of 2018.08.28.