about Redis
Redis is an open source, Key-value database that is written in ANSI C language, supports the network, and can be persisted based on memory.
Download the resources needed for development
http://download.csdn.net/detail/wangj1130/9143339
Redis Installation
Unzip the redis-2.6 in the resource into Redis-2.6\bin\release decompression Redisbin64
Redis-server.exe is the Reids service program, you can double-click to run directly. If you run directly, Redis prints a warning:
# warning:no config file specified, using the default Config. In order to specify a config file use redis-server/path/to/redis.conf
This means that you do not specify a Redis profile, Reids uses the default configuration, and you can run Redis by specifying reids.conf from the command line after you configure the environment variable
Jedis use
Jedis-2.1.0.jar and Commons-pool-1.5.6.jar in the new Project introduction resource
Demo
Public class Jedisdemo { publicstaticvoid main (string[] args) { new Jedis ("127.0.0.1", 6379); Jedis.connect (); Jedis.set ("message", "Hello World"); System.out.println (Jedis.get ("message")); Jedis.quit (); }}
Using the Redis Connection pool demo
Public classJedisdemo { Public Static voidMain (string[] args) {jedispoolconfig config=NewJedispoolconfig (); Config.setmaxactive (20); Config.setmaxidle (5); Config.setmaxwait (1000l); Config.settestonborrow (false); Jedispool Jedispool=NewJedispool (config, "127.0.0.1", 6379); Jedis Jedis=Jedispool.getresource (); Jedis.set ("Message", "Hello World"); System.out.println (Jedis.get ("Message")); Jedis.quit (); }}
Using Jedis to develop Redis under Java