memcachedenyimenyim.caching

Unable to get stored memcached client value


Unable to get stored memcached client value

this does not retrive the value of TEST , what is the wrong in this code?

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

Solution

  • I found the solution , before run this code i would have installed the memcached.exe

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