コード例 #1
0
 public async Task<StatRecord> GetBucketStats(Game game)
 {
     var bucketKey = game.CreateBucketKey();
     var res= await Cache.GetBucket(bucketKey);
     if (res == null)
     {
         MisBucketStats[game.Turn]++;
     }
     else
     {
         Collections.TryAdd(res.Collection.Key, null);
         HitBucketStats[game.Turn]++;
     }
     return res;
 }
コード例 #2
0
        public async Task<StatRecord> Record(Game game, long cash, long count)
        {
            var bucketKey = game.CreateBucketKey();
            var tailKey = game.CreateTailKey();

            StatRecord record = await Cache.IncrementBucket(bucketKey, cash, count);
            if (record.Count == count)
            {
                CreateBucketStats[game.Turn]++;
            }
            else
            {
                UpdateBucketStats[game.Turn]++;
            }

            UpdateTailStats[game.Turn]++;
            Cache.SetTail(tailKey, record.AggCash, record.Count);

            return record;
        }