コード例 #1
0
        public async Task AddOrUpdate(ReceiptDescriptionCacheModel model)
        {
            try
            {
                var receiptDescriptions = await LoadFromRedis();

                var receiptDescription = receiptDescriptions.FirstOrDefault(c => c.Id == model.Id);
                if (receiptDescription == null)
                {
                    receiptDescriptions.Add(model);
                }
                else
                {
                    receiptDescription.Name = model.Name;
                }

                await DistributedCache.Set(_cacheKey,
                                           receiptDescriptions);
            }
            catch (Exception exception)
            {
                _logger.Info(exception.ToString);
            }
        }
コード例 #2
0
 public UpdateReceiptDescriptionModel(ReceiptDescriptionCacheModel model)
 {
     Id   = model.Id;
     Name = model.Name;
 }