本文整理匯總了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
};
}