var redis = ConnectionMultiplexer.Connect("localhost");
//ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("server1:6379,server2:6379"); 连接两台服务器
var dbIndex = 0;
var db = redis.GetDatabase(dbIndex);//访问第一台服务器
var redis = ConnectionMultiplexer.Connect("localhost");
//ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("server1:6379,server2:6379"); 连接两台服务器
var dbIndex = 0;
db.StringSet("zhansan" , "张三");//写入
MongoDB
MongoClient client=new MongoClient("mongodb://127.0.0.1:27017");
IMongoDatabase db=client.GetDatabase("School");
var con = db.GetCollection<object>("student");
//con.InsertOne(new {id=3,name="王五" });
var filter = Builders<object>.Filter.Eq("id", 1);
var data=con.Find(filter).FirstOrDefault();
Console.WriteLine("成功:"+data);
Console.ReadLine();