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

时间:2013-06-18 11:07:31

标签: memcached enyim enyim.caching

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

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

Console.Out.WriteLine( “START:”);

                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);
            }

1 个答案:

答案 0 :(得分:0)

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

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