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.
- Download tar.gz or zip file, unzip open can see, Jedis use is MAVEN build engineering.
- Using Eclipse's MAVEN project import, in the package Exploer right-click Import, select Maven project.
- 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