Getting Started with the Redis memory cache system

Source: Internet
Author: User

Website: http://redis.io/

Key-value Cache and store data structure Server

1. Server-side1.1 Installation

Download the installation package: Http://redis.io/download

After you unzip, make.

wget http://download.redis.io/releases/redis-3.0.0.tar.gztar xzf redis-  3.0. 0. Tar . gz$ CD Redis-3.0. 0   make
1.2 Operating mode:
$ src/redis-server

This startup mode uses the default configuration, or it can be started by specifying a configuration file location, as follows:

$ src/redis-server redis.conf
1.3 Access rights control how 1.3.1 binds IP

In the configuration file, add the following:

127.0. 0.1 IP1 IP2 ...
1.3.2 Setting a password

In the configuration file, add the following:

Requirepass YourPassword
1.4 Built-In client:
$ src/redis-Cliredis> set foo barokredis> get foo"bar"
1.4.1 Authorized Access
$ src/redis-Cliredis> auth password redis> set foo barokredis> get foo  "bar"

Login with Password method

$ src/redis-cli-a Passwordredis> set foo barokredis> get foo"Bar "
2. Client

Http://redis.io/clients

A client that supports many languages, here is a description of Java Jedis.

2.1 Jedis Source

Https://github.com/xetorthio/jedis

After downloading Jedis, you can compile and build the jar file for later use.

    1. Download tar.gz or zip file, unzip open can see, Jedis use is MAVEN build engineering.
    2. Using Eclipse's MAVEN project import, in the package Exploer right-click Import, select Maven project.
    3. Right-click Export the jar file package.
2.2 Java Test Program

 Packagecn.ac.iscas.test;ImportRedis.clients.jedis.Jedis;Importorg.junit.Test;/*** @ClassName: MyTest * @Description: TODO *@author: * @Date: 2015-04-12 19:27:09*/ Public classMyTest { Public StaticJedis Jedis =NULL; //Redis host IP address     Public Static FinalString HOST = "192.168.1.144"; //Redis Host Ports     Public Static FinalInteger PORT = 6379;  Public StaticJedis getclient () {if(Jedis = =NULL) {Jedis=NewJedis (HOST, PORT); }        returnJedis; } @Test Public voidTest () {getclient (); Jedis.set ("Key", "123"); System.out.println (Jedis.get ("Key")); JEDIS.INCR ("Key"); System.out.println (Jedis.get ("Key")); }}

Getting Started with the Redis memory cache system

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.