예제 #1
0
        private void InsertGameBetBatchAsync()
        {
            IGameBetItem[] bBuffer;
            lock (this)
            {
                bBuffer = new IGameBetItem[_gameBetCache.Count];
                _gameBetCache.CopyTo(bBuffer);
                _gameBetCache.Clear();
            }
            Thread t = new Thread(new ParameterizedThreadStart(InsertGameBetBatchTSig));

            t.Start(bBuffer);
        }
예제 #2
0
 public static GameBetEntity CreateEntity(IGameBetItem src)
 {
     return(new GameBetEntity
     {
         PartitionKey = GetPartitionKey(src.UserId, DateTime.UtcNow),
         RowKey = GetRowKey(src.BoxId, src.Date),
         UserId = src.UserId,
         BoxId = src.BoxId,
         AssetPair = src.AssetPair,
         BetAmount = src.BetAmount,
         Box = src.Box,
         Date = src.Date,
         Parameters = src.Parameters,
         BetStatus = src.BetStatus
     });
 }
예제 #3
0
        public Task SaveGameBet(IGameBetItem bet)
        {
            if (bet == null)
            {
                return(Task.FromResult(0));
            }

            var existingBet = _gameBetCache.Where(b => b.BoxId == bet.BoxId).FirstOrDefault();

            if (existingBet != null)
            {
                _gameBetCache.Remove(existingBet);
            }

            _gameBetCache.Add(bet);
            if (_gameBetCache.Count > _maxBuffer)
            {
                InsertGameBetBatchAsync();
            }

            return(Task.FromResult(0));
        }
예제 #4
0
 public Task SaveGameBet(IGameBetItem bet)
 {
     throw new NotImplementedException();
 }