. NET Memcache

Source: Internet
Author: User

Thank you very much for csdn and the cold Moon. The Lord made me quickly learn. NET Operations Memcache article from: http://download.csdn.net/detail/e_wsq/4358982

Example 1 of C # access Memcache put Commons.dll,icsharpcode.sharpziplib.dll,log4net.dll,memcached.clientlibrary.dll in bin directory 2 Reference Memcached.ClientLibrary.dll

1   string[] ServerList = {"127.0.0.1:11211","90.0.12.120:11211" };2 3             //Initialize Pool4Sockiopool pool =sockiopool.getinstance ();5 pool. Setservers (serverlist);6 7Pool. Initconnections =3;8Pool. Minconnections =3;9Pool. MaxConnections =5;Ten  OnePool. Socketconnecttimeout = +; APool. Sockettimeout = the; -  -Pool. Maintenancesleep = -; thePool. Failover =true; -  -Pool. Nagle =false; - pool. Initialize (); +  -             //get the client instance +memcachedclient MC =Newmemcachedclient (); AMc. EnableCompression =false; at  -Console.WriteLine ("------------Test-----------"); -Mc. Set ("test1","This is test");//stores the data to the cache server, where the string "My value" is cached, and key is "test" -  -             if(MC. Keyexists ("Test"))//test cache has a project with key test -             { inConsole.WriteLine ("the value of key for test is correctly written"); -Console.WriteLine ("the value of test is:"+MC. Get ("Test"). ToString ());//get the item with key test in the cache to             } +             Else -             { theConsole.WriteLine ("Test not Exists"); *             } $ Panax Notoginseng            //console.readline (); -             vartt = MC. Get ("Test"); the             //MC.  Delete ("test"); //Remove the item in the cache with key test +             A             if(MC. Keyexists ("Test")) the             { +Console.WriteLine ("test is Exists"); -Console.WriteLine (MC. Get ("Test"). ToString ()); $             } $             Else -             { -Console.WriteLine ("value has been deleted"); the             } -             //console.readline ();Wuyi  theSockiopool.getinstance (). Shutdown ();//Close the pool, close sockets
View Code

. NET Memcache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.