internal Task <bool> ExecuteBoolean(RedisMessage message, bool queueJump) { var msgResult = new MessageResultBoolean(); message.SetMessageResult(msgResult); EnqueueMessage(message, queueJump); return(msgResult.Task); }
// avoid lots of delegate creations internal override IEnumerable <RedisMessage> CreateMessages() { yield return(RedisMessage.Create(db, RedisLiteral.WATCH, key)); var msgResult = new MessageResultBoolean(this); msgResult.Task.ContinueWith(testExisted); RedisMessage message = hashField == null ? RedisMessage.Create(db, RedisLiteral.EXISTS, key) : RedisMessage.Create(db, RedisLiteral.HEXISTS, key, hashField); message.SetMessageResult(msgResult); yield return(message); }
internal override IEnumerable <RedisMessage> CreateMessages() { yield return(RedisMessage.Create(db, RedisLiteral.WATCH, key)); var msgResult = new MessageResultBoolean(this); // we want this ExecuteSynchronously so that we can exploit the ordered nature of the reader to check all the // results efficiently msgResult.Task.ContinueWith(testExisted, TaskContinuationOptions.ExecuteSynchronously); var message = hashField == null?RedisMessage.Create(db, RedisLiteral.EXISTS, key) : RedisMessage.Create(db, RedisLiteral.HEXISTS, key, hashField); message.SetMessageResult(msgResult); yield return(message); }