标签:++ 安装 lin mysql download print and cli pre
1、linux 系统下安装
$ wget http://download.redis.io/releases/redis-3.2.6.tar.gz
tarxzfredis?3.2.6.tar.gztarxzfredis?3.2.6.tar.gz
cd redis-3.2.6
$ make
启动服务器: ``` $ src/redis-server ``` 启动客户端 ``` $ src/redis-cli ``` mac下安装: ``` brew install redis
启动:
redis-server
redis-cli
前提是redis 已经安装,并且已经开启服务。
jedis 下载地址 https://github.com/xetorthio/jedis
public static void main(String[] args){ Jedis jedis = new Jedis("localhost"); System.out.println("Connection to server sucessfully"); //check whether server is running or not System.out.println("Server is running: "+jedis.ping()); jedis.lpush("forezp-list", "Redis"); jedis.lpush("forezp-list", "Mongodb"); jedis.lpush("forezp-list", "Mysql"); // Get the stored data and print it List<String> list = jedis.lrange("forezp-list", 0 ,5); for(int i=0; i<list.size(); i++) { System.out.println("Stored string in redis:: "+list.get(i)); } }
标签:++ 安装 lin mysql download print and cli pre
原文地址:https://www.cnblogs.com/AttackLion/p/9199337.html