public async Task AddGaUserTrafficAsync(IGaTraffic traffic)
        {
            await _trafficRepository.AddAsync(traffic);

            var value = MessagePackSerializer.Serialize(new CachedGaTraffic(traffic));
            await _cache.SetAsync(GetTrafficKey(traffic.ClientId), value);
        }
 public CachedGaTraffic(IGaTraffic traffic)
 {
     ClientId = traffic.ClientId;
     Source   = traffic.Source;
     Medium   = traffic.Medium;
     Campaign = traffic.Campaign;
     Keyword  = traffic.Keyword;
     Content  = traffic.Content;
 }
Example #3
0
 public static GaTrafficEntity Create(IGaTraffic src)
 {
     return(new GaTrafficEntity
     {
         PartitionKey = GeneratePartitionKey(),
         RowKey = GenerateRowKey(src.ClientId),
         ClientId = src.ClientId,
         Source = src.Source,
         Medium = src.Medium,
         Campaign = src.Campaign,
         Keyword = src.Keyword,
         Content = src.Content
     });
 }
        public Task AddAsync(IGaTraffic model)
        {
            var entity = GaTrafficEntity.Create(model);

            return(_tableStorage.InsertOrMergeAsync(entity));
        }