Beispiel #1
0
        public static void AddGameResultToRedis(GameResult gameResult)
        {
            IDatabase db = GetRedisDatabase();

            var gameResults = new RedisDictionary <int, GameResult>("gameResults");

            gameResults.Add(gameResult.game_id, gameResult);

            db.SortedSetIncrement("leaderboard", gameResult.game_id, gameResult.total_score);
        }
Beispiel #2
0
        public static void AddGameResultListToRedis(List <GameResult> gameResultList)
        {
            IDatabase db = GetRedisDatabase();

            var gameResults = new RedisDictionary <int, GameResult>("gameResults");

            foreach (GameResult item in gameResultList)
            {
                gameResults.Add(item.game_id, item);
                db.SortedSetIncrement("leaderboard", item.game_id, item.total_score);
            }
        }