Redis本质上是一个Key-Value类型的内存数据库。
1)下载redis服务:https://github.com/dmajkic/redis/downloads
解压有如下文件:
2)下载jedis(jar):https://github.com/xetorthio/jedis/downloads
3)新建java项目RedisTest及测试类:
import redis.clients.jedis.Jedis;
public class JedisDemo {
public static void main(String[] args) {
Jedis jj = new Jedis("localhost");
jj.set("key1", "I am value 1");
String ss = jj.get("key1");
System.out.println(ss);
}
}
4)导入jedis-2.0.0.jar
5)运行redis服务redis-server.exe
6)运行JedisDemo项目,输出:I am value 1