Rides

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RedisCall
{
using ServiceStack.Redis;

class Program
{
static void Main(string[] args)
{
//开始调用
//1.0 确定redis服务器的ip(127.0.0.1)+port (默认6379)
//2.0 实例化redis的客户端实例
using (var client = RedisClientFactory.Instance.CreateRedisClient("127.0.0.1", 6379))
{
//3.0 利用Set存储数据:特点:如果key不存在,则创建,否则跟新其数据(相同的键后面的会覆盖前面的)
client.Set<string>("name1", "{name:ivan}");
client.Set<string>("name1", "{name:ivan11111111}");

Console.WriteLine(client.Get<string>("name1"));

//4.0 List
client.AddItemToList("age1", "29");
client.AddItemToList("age1", "30");
client.AddItemToList("age1", "29");

List<string> list = client.GetAllItemsFromList("age1");
list.ForEach(c => Console.WriteLine(c));

//5.0 Set 用于数据消重
client.AddItemToSet("蜀国", "刘备");
client.AddItemToSet("蜀国", "张飞");
client.AddItemToSet("蜀国", "刘备");

client.GetAllItemsFromSet("蜀国").ToList().ForEach(c => Console.WriteLine(c));

//6.0 实现队列操作(先进先出)
//client.EnqueueItemOnList("魏国", "老王");
//client.EnqueueItemOnList("魏国", "曹操");
//client.EnqueueItemOnList("魏国", "张辽");

int count = client.GetListCount("魏国");
for (int i = 0; i < count; i++)
{
//将数据出队列以后,同时移除该数据
Console.WriteLine(client.DequeueItemFromList("魏国"));
}

}

Console.ReadKey();
}

}
}

时间: 2024-10-01 02:31:04

Rides的相关文章

uva 507 Jill Rides Again (分治)

uva 507 Jill Rides Again Jill likes to ride her bicycle, but since the pretty city of Greenhills where she lives has grown, Jill often uses the excellent public bus system for part of her journey. She has a folding bicycle which she carries with her

uva507 - Jill Rides Again(最长连续和)

题目:uva507 - Jill Rides Again(最长连续和) 题目大意:给每两个站之间的满意度,满意的路线必须加起来的和不小于0.帮Jill找出她满意的路线,要求是最长的,并且一样长的话取站相对靠前的. 代码: #include <stdio.h> #include <string.h> const int N = 20005; int s, b, e; int stop[N]; int solve () { int mm = stop[1]; int sum = sto

uva 507 Jill Rides Again (DP)

uva 507 Jill Rides Again Jill likes to ride her bicycle, but since the pretty city of Greenhills where she lives has grown, Jill often uses the excellent public bus system for part of her journey. She has a folding bicycle which she carries with her

UVa 507 Jill Rides Again (最大连续子序列)

Jill Rides Again Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Submit Status Description  Jill Rides Again  Jill likes to ride her bicycle, but since the pretty city of Greenhills where she lives has grown, Jill often uses

有关rides数据库的想法

今天在想如何用redis实现蕾丝与新浪微博的关注用户和粉丝时,突然发现在mysql里面只需要一个表就可以了,有一个关注者和被关注者的对应即可. redis需要对每一个用户有两个相关的键,一个关注的人,一个自己的粉丝,都是集合的形式.表面上感觉mysql数据库的设计好像简单点儿,一个表直接搞定,可是细想一下,如果一一对应的话,恐怕这个数据表也太大了,索引起来估计慢的吓人.虽然redis数据库好像复杂点儿,每个用户要有两个对应的字段 ,可是所有的键唯一,时间复杂对为o(1),而且在内存中,读去速度更

UVa 507 - Jill Rides Again

动态规划 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 using namespace std; 5 6 #define MAXN 20002 7 8 int routes,stopNum; 9 int stops[MAXN]; 10 int maxSum,st,en,newSt; 11 12 int main() 13 { 14 #ifndef ONLINE_JUDGE 15 freo

分布式 +rides

redis分布式部署 1.scrapy框架是否可以自己实现分布式? - 不可以.原因有二. 其一:因为多台机器上部署的scrapy会各自拥有各自的调度器,这样就使得多台机器无法分配start_urls列表中的url.(多台机器无法共享同一个调度器) 其二:多台机器爬取到的数据无法通过同一个管道对数据进行统一的数据持久出存储.(多台机器无法共享同一个管道) 2.基于scrapy-redis组件的分布式爬虫 - scrapy-redis组件中为我们封装好了可以被多台机器共享的调度器和管道,我们可以直

Data Science(什么是数据科学)

科学上网时看到的有关于Data Science的理解,感觉挺好的,就翻一下. Data science is about understanding systems, whether they be natural systems such as climate, or man-made systems like the economy. (数据科学可以称之为理解系统,无论这个系统是自然系统,例如天气系统,或者人造的生态环境系统). Scientists have been conducting

STL语法——映射:map 反片语(Ananagrams,UVa 156)

Description Most crossword puzzle fans are used to anagrams--groups of words with the same letters in different orders--for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have this attribute, no matter how you rearrange their lett