public async Task AddOrUpdate(CustomerSourceCacheModel model) { try { var customerSources = await LoadFromRedis(); var customerSource = customerSources.FirstOrDefault(c => c.Id == model.Id); if (customerSource == null) { customerSources.Add(model); } else { customerSource.Name = model.Name; } await DistributedCache.Set(_cacheKey, customerSources); } catch (Exception exception) { _logger.Info(exception.ToString); } }
public CustomerSourceModel(CustomerSourceCacheModel model) { Id = model.Id; Name = model.Name; }