Learn to get started with Redis

Source: Internet
Author: User

Redis Installation

$ 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

Redis Boot

$ src/redis-server


Redis Simple test:

$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

Complex tests:

./runtest (Note: to first install TCL 8.5 tk 8.5, sudo apt-get install TK)

This command will run an official test program. Look at the final conclusion: all tests pass successfully.

This allows the client to connect.

There are a lot of client software, in this connection there is a list: http://redis.io/clients

Most familiar with C #, choose a C # client, Servicestack.redis This can be found in the NuGet interface. Locate and then 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: about 14 seconds to store 100,000 keys, about 14 seconds to remove 100,000 keys.

Article Source: Redis Introductory Learning

Learn to get started with Redis

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.