RedisIs a key-value storage system. Similar to memcached, But it solves the problem that data is completely lost after power-off, and she supports more undefined value types. Besides string, it also supports lists (linked list), sets, and zsets. These data types support push/pop, Add/Remove, Intersection Set and difference set, and more abundant operations, and these operations are atomic.
Redis Code follows the ANSI-C and can be written in all POSIX systems (such as Linux,*BSD, Mac OS X, Solaris, etc. In addition, redis does not rely on any non-standard library, nor does it need to add compilation parameters. The installation of apsaradb for redis is surprisingly simple, which may be one of the reasons why it is popular and easy to use.
1 download
: Redis download, latest stable edition redis-2.6.9.tar.gz
Document: redis document
2 Installation
$ wget http://redis.googlecode.com/files/redis-2.6.9.tar.gz$ tar xzf redis-2.6.9.tar.gz$ cd redis-2.6.9$ make
3 command
1) Start the server
Src/redis-server redis. conf
2) Enable the client
Src/redis-cli
3) test command
Redis 127.0.0.1: 6379> set myname "Yanggang"
OK
Redis 127.0.0.1: 6379> Get myname
"Yanggang"
Redis 127.0.0.1: 6379> set myblog "http://blog.csdn.net/sunboy_2050"
OK
Redis 127.0.0.1: 6379> Get myblog
Http://blog.csdn.net/sunboy_2050"
4 client Programming
Code:
import redis.clients.jedis.Jedis;public class JedisTest {public static void main(String[] args) {Jedis jedis = new Jedis("localhost");jedis.set("foo", "bar");String value = jedis.get("foo");System.out.print("foo's value : " + value);}}
Running result:
Foo's value: bar
Getting started with redis
Introduction to redis installation and configuration (recommended)
Install redis and configure master-slave Replication
Redis memcache Performance Comparison
Essential differences between memcache and redis