public static async Task <IEnumerable <TOutput> > RetreiveAllObjectFromStringStoreAsync <TOutput, TKey>( this IPersistentStore <TKey, string> store, CancellationToken token) { var inMemoryState = await store.GetAllValuesAsync(token).ConfigureAwait(false); return(inMemoryState.Select(one => InsightsUtil.DeSerialize <TOutput>(one.Value)).ToList()); }
public static async Task <TOutput> CreateOrRetriveRetreiveObjectFromStoreAsync <TOutput, TKey>( this IPersistentStore <TKey, string> store, TKey key, TOutput defaultVal, CancellationToken token) { await store.SetIfNotPresentAsync(key, InsightsUtil.Serialize(defaultVal), token).ConfigureAwait(false); var deserialized = await store.GetEntityAsync(key, token).ConfigureAwait(false); return(InsightsUtil.DeSerialize <TOutput>(deserialized)); }