C# 阿里云Redis存储服务 使用总结

//先导入这个库

using ServiceStack.Redis;

string host = "";/*访问host地址*/

string password = "";/*密码*/

RedisClient redisClient = new RedisClient(host, 6379, password);//

//指定要操作哪个db  (0-256)

redisClient.ChangeDb(1);

//插入List的方式

redisClient.PushItemToList(‘key’,’value’);

redisClient.PushItemToList(‘key’,’value1’);

//根据key查询List

 List model = redisClient.GetAllItemsFromList(‘key’);

//插入单个数据

redisClient.Add("StringKey", " StringValue”);

//获取单个数据

redisClient.Get("StringKey")

2018年08月14日22:58:18

你可能感兴趣的:(C# 阿里云Redis存储服务 使用总结)