Install Redis
$ wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
$ tar xzf redis-2.6.13.tar.gz
$ cd redis-2.6.13
$ make
Start Redis
$ src/redis-server
Simple Redis test:
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
Complex testing:
./Runtest (Note: first install tcl 8.5 tk 8.5, sudo apt-get install tk)
This command runs an official test program. Conclusion: All tests are successful.
In this way, the client can be connected.
There are a lot of client software, In this connection there is a list: http://redis.io/clients
If you are familiar with c #, select a c # client, ServiceStack. Redis, which can be found on the Nuget interface. Find and join the project.
using ServiceStack.Redis;using System.Diagnostics;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { Stopwatch sw = new Stopwatch(); sw.Start(); using (var client = new RedisClient("192.168.63.134")) { for (int i = 0; i < 100000; i++) { client.Add("key" + i, i); } } sw.Stop(); System.Console.WriteLine("It takes " + sw.ElapsedMilliseconds + "ms to add 100000 key to Redis"); sw.Restart(); using (var client = new RedisClient("192.168.63.134")) { for (int i = 0; i < 100000; i++) { client.Get("key" + i); } } sw.Stop(); System.Console.WriteLine("It takes " + sw.ElapsedMilliseconds + "ms to get 100000 key from Redis"); System.Console.ReadKey(); } }}
My machine runs the result: 100000 keys are stored in about 14 seconds, and 100000 keys are retrieved in about 14 seconds.