ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost"); db = redis.GetDatabase(); EndPoint ep = db.IdentifyEndpoint(); server = redis.GetServer(ep); //Add Resid by Key-Value RedisValue v = "a"; db.StringSet("stringKey", v); Dictionary<RedisKey, RedisValue> dics = new Dictionary<RedisKey, RedisValue>() { {"stringKeyA", "S_1"}, {"stringKeyB", "S_2"} }; db.StringSet(dics.AsQueryable().ToArray(), When.Always, CommandFlags.None); //Add to Resid by Set Value RedisValue[] values = { "d", "e", "f" }; long size = db.SetAdd("SetKey", values); IEnumerable<RedisValue> setvalue = db.SetScan("SetKey"); //Add to Redis by List Value db.ListRightPush("ListKey", "abcdefghijklmnopqrstuvwxyz".Select(x => (RedisValue)x.ToString()).ToArray()); RedisValue[] listvalue = db.ListRange("ListKey", 0, -1); //Key Confirm foreach (RedisKey k in server.Keys()) { MessageBox.Show(k.ToString()); }
2015년 6월 17일 수요일
Redis with StackExchange.Redis.StrongName(Sample Code)
라벨:
.NET Framework,
Redis