using System; using System.Collections.Generic; using System.Linq; using System.Text; using ServiceStack.Redis; namespace RedisTest3_LPUSH { class Program { static void Main(string[] args) { var r = Console.ReadLine().ToString(); if (r == "push") { push(); } else { pop(); } Console.ReadLine(); } public static void push() { Console.WriteLine("push---"); IRedisClient client = new RedisClient("127.0.0.1", 6379); while(true) { client.PushItemToList("list1", Console.ReadLine()); } Console.WriteLine("ok"); } public static void pop() { Console.WriteLine("pop---"); IRedisClient client = new RedisClient("127.0.0.1", 6379); while (true) { var msg = client.PopItemFromList("list1"); if(!string.IsNullOrEmpty(msg)) Console.WriteLine(msg); } } } }