One. Install the server:
Service side: Http://code.jellycan.com/files/memcached-1.2.6-win32-bin.zip
64:http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available
1. Unzip the file to C:\memcached
2. Command line input ' c:\memcached\memcached.exe-d install '
3. Command line input ' c:\memcached\memcached.exe-d start ', the command starts memcached, the default listener port is 11211
You can view its help through memcached.exe-h
Problems with the installation may occur:
If the problem occurs:
There are 1 scenarios where you can find the Cmd.exe right-click Administrator to run.
2 is going to service there to see if it's already installed
Two. Download the client
Client: http://sourceforge.net/projects/memcacheddotnet/
e:\memcached\memcached.exe-d Install
Three. Use
1. Place the Commons.dll,icsharpcode.sharpziplib.dll,log4net.dll,memcached.clientlibrary.dll in the bin directory
2. Quoting Memcached.ClientLibrary.dll
Code:
Using system;using Memcached.clientlibrary;namespace membercache{class Program {static void Main (string[] A RGS) {string[] serverlist = {"127.0.0.1:11211", "127.0.0.1:11211"}; Initialize pool Sockiopool pond = sockiopool.getinstance (); Pool. Setservers (serverlist); Pool. Initconnections = 3; Pool. Minconnections = 3; Pool. MaxConnections = 5; Pool. socketconnecttimeout = 1000; Pool. Sockettimeout = 3000; Pool. Maintenancesleep = 30; Pool. Failover = true; Pool. Nagle = false; Pool. Initialize (); Get the client instance memcachedclient mc = new Memcachedclient (); Mc. EnableCompression = false; Console.WriteLine ("------------Test-----------"); Mc. Set ("Test", "my Value"); Stores the data to the cache server, where the string "My value" is cached, and the key is "test" if (MC. Keyexists ("test"))//test cache exists key test for project {COnsole. WriteLine ("Test is Exists"); Console.WriteLine (MC. Get ("Test"). ToString ()); Gets the item with the key test in the cache} else {Console.WriteLine ("Test Not Exists"); } console.readline (); Mc. Delete ("test"); Removes the item if (MC) of the key test in the cache. Keyexists ("test")) {Console.WriteLine ("Test is Exists"); Console.WriteLine (MC. Get ("Test"). ToString ()); } else {Console.WriteLine ("Test Not Exists"); } console.readline (); Sockiopool.getinstance (). Shutdown (); } }}
Operation Result:
Finally: Write bad, see the uncomfortable you come to hit me.
Distributed Cache Memcached Learning