Redis>RPUSH & BLPOP Usage
(BEGIN)RPUSH & BLPOP Usage-------------------------------------------------
1. 터미널에서 RPUSH 커맨드로 list2 키를 추가한다.
127.0.0.1:6379> RPUSH list2 a b c
(integer) 3
2. 터미널에서 BLPOP 커맨드를 호출한다. 리스트의 앞 엘리먼트부터 pop한 것을 확인할 수 있다.
127.0.0.1:6379> BLPOP list1 list2 0
1) "list2"
2) "a"
127.0.0.1:6379> BLPOP list1 list2 0
1) "list2"
2) "b"
127.0.0.1:6379> BLPOP list1 list2 0
1) "list2"
2) "c"
127.0.0.1:6379> BLPOP list1 list2 0
(블럭됨)
(END)RPUSH & BLPOP Usage-------------------------------------------------
c# code example(approximately)
c# code example(approximately)
RedisClient sendRedis = null;
RedisClient recvRedis = null;
byte[] jsonByteData = sendQueue.Dequeue();
int rc = sendRedis.RPush("QCS", jsonByteData);
jsonByteData = recvRedis.BLPop("CLI:" + ClientCurrentId.GetInstance.MyID,10);