you need to get a single first.
eg:
using System; using Enyim.Caching; using Enyim.Caching.Memcached; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace UnitTestProject1 { [TestClass] public class UnitTest1 { [TestMethod] public void TestMethod1() { MemcachedClient client = MemcachedManager.Instance;//new MemcachedClient(); client.Store(StoreMode.Set, "b", "bb", new TimeSpan(1, 1, 300)); var x = client.Get("b"); client.Store(StoreMode.Set, "a", "aa"); var y = client.Get("a"); client.Store(StoreMode.Set, "c", "cc", DateTime.Now.AddSeconds(300)); var z = client.Get("c"); client.Store(StoreMode.Set, "c", "ccc"); var t = client.Get("c"); Console.WriteLine("{0},{1},{2}",x,y,z); } } public static class MemcachedManager { private readonly static MemcachedClient _instance; static MemcachedManager() { _instance = new MemcachedClient(); } public static MemcachedClient Instance { get { return _instance; } } } }
source share