#USING
using ServiceStack.Redis;

#DELCARE
RedisClient sendRedis = null;
RedisClient receiveRedis = null;

#CONNECT
sendRedis = new RedisClient("10.245.1.65", 9111);
recvRedis = new RedisClient("10.245.1.65", 9111);

#PUSH
byte[] sendbytes = Encoding.UTF8.GetBytes(qryText);

int resultcode = sendRedis.RPush("QCS", sendbytes);

if(resultcode==1){}

#POP
string sendFormatText = "CLI:/cli/admin/" + "127.0.0.1" + "/" + "45645";

byte[][] recvbytes = null;
recvbytes = recvRedis.BLPop(sendFormatText, 1);
for(int ii=0; ii<recvbytes.Length; ii++)
{
byte[] jsonbyte = new byte[recvbytes[ii].Length];
recvbytes[ii].CopyTo(jsonbyte, 0);

formatText = Encoding.UTF8.GetString(jsonbyte);

if(ii==1){}
}

#COMPILE
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /reference:Newtonsoft.Json.Net20.dll,ServiceStack.dll,ServiceStack.Interfaces.dll,ServiceStack.ServiceInterface.dll /out:send_shmqry.exe send_shmqry.cs

'REDIS' 카테고리의 다른 글

Redis 기본 자료 구조 및 명령어(set,get,push,pop)  (0) 2022.12.06

+ Recent posts