0

无法获取存储的 memcached 客户端值

这不会检索 TEST 的值,这段代码有什么问题?

Console.Out.WriteLine("开始:");

                var cfg = new MemcachedClientConfiguration();

                cfg.AddServer("127.0.0.1", 11211);
                cfg.Protocol = MemcachedProtocol.Binary;
                //cfg.SocketPool.MinPoolSize = 10;
                //cfg.SocketPool.MaxPoolSize = 50;
                //TimeSpan ts = new TimeSpan(0, 10, 0);
                //cfg.SocketPool.ConnectionTimeout=ts;
                //cfg.SocketPool.DeadTimeout = ts;

        //cfg.SocketPool
        //var m = new MemcachedClient(cfg);

                MemcachedClient client = new MemcachedClient(cfg);

            client.Store(StoreMode.Set, "Test2", "Hello World");

            //Get a string
            //var myVal = client.Get<string>("Test2");
            string str = client.Get("Test2") as string;
            if (str != null)
            {
                Console.Out.WriteLine("Fetched item with key: mystring, value: " + str);
            }
4

1 回答 1

0

我找到了解决方案,在运行此代码之前,我会安装 memcached.exe

http://zurmo.org/wiki/installing-memcache-on-windows

于 2013-06-19T04:13:11.057 回答