Exemplo n.º 1
0
        /// <summary>
        /// Send the buffered commands
        /// </summary>
        public virtual void Send(bool keepTogether = false, bool queueJump = false)
        {
            var all = DequeueAll();

            if (keepTogether && all.Length > 1)
            {
                var msg = new BatchMessage(all);
                parent.EnqueueMessage(msg, queueJump);
            }
            else
            {
                parent.EnqueueMessages(all, queueJump);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Sends all currently buffered commands to the redis server in a single unit; the transaction may subsequently be re-used to buffer additional blocks of commands if needed.
        /// </summary>
        public Task <bool> Execute(bool queueJump = false, object state = null)
        {
            RedisMessage[] all = DequeueAll();
            if (all.Length == 0)
            {
                var nix = new TaskCompletionSource <bool>();
                nix.SetResult(true);
                return(nix.Task);
            }
            var multiMessage = new MultiMessage(parent, all, conditions, state);

            conditions = null; // wipe
            parent.EnqueueMessage(multiMessage, queueJump);
            return(multiMessage.Completion);
        }