Inheritance: IDisposable
Exemplo n.º 1
0
 public void Roundtrip_with_single_key() {
     using(var client = new MemcacheClient(_endPoint)) {
         _log.Debug("created client");
         client.Put("foo", 123, TimeSpan.Zero, Encoding.UTF8.GetBytes("hello"));
         _log.Debug("put data");
         var data = client.Get("foo");
         _log.Debug("got data");
         Assert.AreEqual(123, data.Flags);
         Assert.AreEqual("hello", Encoding.UTF8.GetString(data.Data));
     }
 }
Exemplo n.º 2
0
 public void Roundtrip_with_multiple_keys() {
     using(var client = new MemcacheClient(_endPoint)) {
         _log.Debug("created client");
         client.Put("foo", 123, TimeSpan.Zero, Encoding.UTF8.GetBytes("hello1"));
         client.Put("bar", 456, TimeSpan.Zero, Encoding.UTF8.GetBytes("hello2"));
         client.Put("baz", 789, TimeSpan.Zero, Encoding.UTF8.GetBytes("hello3"));
         _log.Debug("put data");
         var data = client.Gets(new[] { "foo", "bar", "bek", "baz" });
         _log.Debug("got data");
         Assert.AreEqual(3, data.Count);
         Assert.IsTrue(data.ContainsKey("foo"));
         Assert.AreEqual(123, data["foo"].Flags);
         Assert.AreEqual("hello1", Encoding.UTF8.GetString(data["foo"].Data));
         Assert.IsTrue(data.ContainsKey("bar"));
         Assert.AreEqual(456, data["bar"].Flags);
         Assert.AreEqual("hello2", Encoding.UTF8.GetString(data["bar"].Data));
         Assert.IsTrue(data.ContainsKey("baz"));
         Assert.AreEqual(789, data["baz"].Flags);
         Assert.AreEqual("hello3", Encoding.UTF8.GetString(data["baz"].Data));
     }
 }