コード例 #1
0
 public static string BlockingPopItemFromList(string listId, TimeSpan?timeOut)
 {
     using (RedisClient client = GetClient())
     {
         return(client.BlockingPopItemFromList(listId, timeOut));
     }
 }
コード例 #2
0
        /// <summary>
        /// 同步阻塞获取消息(推)
        /// </summary>
        /// <param name="queueName">队列名称</param>
        /// <param name="timeout">阻塞超时时间</param>
        /// <returns>消息</returns>
        public string GetMessageBlock(string queueName, TimeSpan?timeout = null)
        {
            // 阻塞等待获取消息
            string message = _redisClient.BlockingPopItemFromList(queueName, timeout);

            return(message);
        }
コード例 #3
0
 public string BlockingPopItemFromList(string listId, TimeSpan?timeOut)
 {
     return(redisClient.BlockingPopItemFromList(listId, timeOut));
 }
コード例 #4
0
ファイル: redisTest.cs プロジェクト: ggwhsd/CSharpStudy
 private void button17_Click(object sender, EventArgs e)
 {
     //移除列表最右边的一个元素,若不存在,则阻塞等待1秒,若1秒时间之后仍然不存在,返回空。
     //语义:栈概念上的弹出含义
     textBox1.Text += "\r\n " + client.BlockingPopItemFromList("list:name",TimeSpan.FromSeconds(1));
 }