.NET?μ???ν??Redis?????
???????????? ???????[ 2015/7/9 10:54:29 ] ??????????????????? ?????
????4?????????????
????????????Redis?????????????????????????????á?
????OK???????????????????ɡ???????????demo??
???????
????1.???????????????
public class RedisManager
{
//???????????д????{ get; private set; } ??????д??
public static PooledRedisClientManager ClientManager { get; private set; }
static RedisManager()
{
RedisClientManagerConfig redisConfig = new RedisClientManagerConfig();
redisConfig.MaxWritePoolSize = 128;
redisConfig.MaxReadPoolSize = 128;
/*??д???????Redis?????
??????????????????1???????дRedis?????????????????????飬????????????????????
????2???????Redis???????????????????
*/
ClientManager = new PooledRedisClientManager(new string[] {"127.0.0.1"}??
new string[] {"127.0.0.1"}?? redisConfig);
}
}
????2.???????
static void Main(string[] args)
{
using (IRedisClient client = RedisManager.ClientManager.GetClient())
{
//1.??????int????
client.Set<int>("age"??18);
client.Get<int>("age");
//2.??????sting????
client.Set<string>("name"??"jim");
string name = client.Get<string>("name");
//3.??????Dictionary????
Dictionary<string?? string> dict = new Dictionary<string?? string>();
dict.Add("aaa"?? "bbb");
client.Set<Dictionary<string?? string>>("dict"??dict);
client.Get<Dictionary<string??string>>(dict);
//4.???????????Ч???
client.Set<string>("name"?? "rupeng"?? DateTime.Now.AddSeconds(30))
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11