/// <inheritdoc/> public async Task <IEnumerable <BlockchainExplorer> > GetAllAsync() { var allBytes = await _distributedCache.GetAsync(_explorersCacheKey); IEnumerable <BlockchainExplorer> all = null; if (allBytes != null) { all = CacheSerializer.Deserialize <IEnumerable <BlockchainExplorer> >(allBytes); } else { all = await _blockchainExplorersService.GetAllAsync(); await _distributedCache.SetAsync(_explorersCacheKey, CacheSerializer.Serialize(all), GetCacheOptions()); } return(all); }
public async Task <BlockchainSetting> GetAsync(string type) { var cachedBytes = await _distributedCache.GetAsync(GetCacheKey(type)); BlockchainSetting item = null; if (cachedBytes != null) { item = CacheSerializer.Deserialize <BlockchainSetting>(cachedBytes); } else { item = await _blockchainSettingsService.GetAsync(type); await _distributedCache.SetAsync(GetCacheKey(type), CacheSerializer.Serialize(item), GetCacheOptions()); } return(item); }