Exemplo n.º 1
0
        public void Commit()
        {
            try
            {
                var resultCount = redisClient.Exec();
                if (resultCount != queuedCommands.Count)
                {
                    throw new InvalidOperationException(string.Format(
                                                            "Invalid results received from 'EXEC', expected '{0}' received '{1}'"
                                                            + "\nWarning: Transaction was committed",
                                                            queuedCommands.Count, resultCount));
                }

                foreach (var queuedCommand in queuedCommands)
                {
                    queuedCommand.ProcessResult();
                }
            }
            finally
            {
                redisClient.CurrentTransaction = null;
                redisClient.AddTypeIdsRegisteredDuringTransaction();
            }
        }