Getting started with Redis

Source: Internet
Author: User
Tags install redis

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.

 

Related Article

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.