本文整理汇总了C#中ServiceStack.Redis.RedisClient.AddItemToList方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.AddItemToList方法的具体用法?C# RedisClient.AddItemToList怎么用?C# RedisClient.AddItemToList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.AddItemToList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestList
private static void TestList()
{
using (var client = new RedisClient("127.0.0.1", 6379))
{
#region "List类型"
client.AddItemToList("HQF.Tutorial.Redis:userInfoId1", "123");
client.AddItemToList("HQF.Tutorial.Redis:userInfoId1", "1234");
Console.WriteLine("List数据项条数:" + client.GetListCount("HQF.Tutorial.Redis:userInfoId1"));
Console.WriteLine("List数据项第一条数据:" + client.GetItemFromList("HQF.Tutorial.Redis:userInfoId1", 0));
Console.WriteLine("List所有数据");
client.GetAllItemsFromList("HQF.Tutorial.Redis:userInfoId1").ForEach(e => Console.WriteLine(e));
#endregion
#region "List类型做为队列和栈使用"
Console.WriteLine(client.GetListCount("HQF.Tutorial.Redis:userInfoId1"));
//队列先进先出
//Console.WriteLine(client.DequeueItemFromList("userInfoId1"));
//Console.WriteLine(client.DequeueItemFromList("userInfoId1"));
//栈后进先出
Console.WriteLine("出栈" + client.PopItemFromList("HQF.Tutorial.Redis:userInfoId1"));
Console.WriteLine("出栈" + client.PopItemFromList("HQF.Tutorial.Redis:userInfoId1"));
#endregion
}
}
示例2: Main
static void Main(string[] args)
{
var redisClient = new RedisClient("121.199.25.195", 6379);
redisClient.AddItemToList("list", "11");
var aa = redisClient.Lists["list"];
Console.WriteLine(aa.Count);
Console.WriteLine(aa[0]);
ConnectionMultiplexer connection = ConnectionMultiplexer.Connect("yhdcache0.redis.cache.windows.net,ssl=false,password=");
}
示例3: data_to_redis
public ActionResult data_to_redis()
{
DataTable table = GetDataTable("select distinct road from familiarrealty_f.houseinfo");
HashSet<string> non_rep_address = new HashSet<string>();
List<String> json_strings = new List<String>();
ServiceStack.Redis.RedisClient redis = new ServiceStack.Redis.RedisClient();
redis.FlushDb();
foreach (DataRow row in table.Rows) {
var json_result = new { road = row["road"].ToString() };
redis.AddItemToList("road:geo", json_result.ToJSON());
json_strings.Add(json_result.ToJSON());
non_rep_address.Add(json_result.ToJSON());
}
//Response.Write(String.Format(@"non_rep_address count is {0},json_string_count is {1}",non_rep_address.Count,json_strings.Count));
return new RenderJsonResult {
Result = json_strings
};
}