1.redis Introduction: Redis is an open source, Advanced key-value storage System. It is commonly referred to as a data structure server, because the value can be a string (string), a hash (hashes), a list, a collection (sets), and an ordered collection (sorted sets). Redis is like memcached, where data is cached in memory to ensure efficiency. The difference is that Redis periodically writes the updated data to disk or writes the modified operation to the appended record file, and Master-slave (Master-Slave) synchronization is implemented on this basis.
2. Installation:
······ Download Redis extract to F:\redis-2.8.12 (Note: The Redis server is placed in an English directory, if the Chinese directory will be error.) )
····· Do not close the console after performing Redis execution
The default open port for Redis is 6379.
3. Download driver Operation Redis via C # code
The test is as follows:
1 class Program2 {3 Static voidMain (string[] args)4 {5 varClient =NewRedisclient ("127.0.0.1",6379);6Client. Additemtosortedset ("part1"," One",1);7Client. Additemtosortedset ("part1"," Both",2);8Client. Additemtosortedset ("part1","three",3);9 Ten varList = client. Getrangefromsortedset ("part1",0,3); One foreach(varIteminchlist) A { - Console.WriteLine (item); - } the Console.readkey (); - } -}
Memcached
...... Installation of memcached
Step1. Download theWindows stable version of Mem cache (http://jehiah.cz/projects/memcached-win32) (Here I downloaded memcached 1.2.1 for Win32 Binaries (Dec 23, 2006) This version), unzip and put under a disk, for example, in c:\memcached
Step2. Enter the ' c:\memcached\memcached.exe-d install ' installation at the terminal (also known as the cmd Command interface)
Step3. Re-enter: ' c:\memcached\memcached.exe-d start ' starts.
PS: memcached will start automatically every time a service is turned on for Windows. This way the server side is already installed.
........ Reference Memcached.ClientLibrary.dll
............... Use
string[] Servers = {"172.16.21.33:11211" }; //Initialize PoolSockiopool pool =sockiopool.getinstance (); Pool. Setservers (servers); Pool. Initconnections=3; Pool. Minconnections=3; Pool. MaxConnections=5; Pool. Socketconnecttimeout= +; Pool. Sockettimeout= the; Pool. Maintenancesleep= -; Pool. Failover=true; Pool. Nagle=false; Pool. Initialize (); Memcachedclient MC=NewMemcached.ClientLibrary.MemcachedClient (); Mc. EnableCompression=false; Mc. Set ("233","233333"); Console.WriteLine (MC. Get ("233"));
Installation and use of Redis and memcached under the WINDOWS64 position