package chat.sms;
|
|
import redis.clients.jedis.Jedis;
|
|
public class Aaa {
|
|
public static void main(String[] args) throws Exception {
|
// TODO Auto-generated method stub
|
//连接本地的 Redis 服务
|
//Jedis jedis = new Jedis("139.196.115.152");
|
Jedis jedis = new Jedis("localhost");
|
// 如果 Redis 服务设置来密码,需要下面这行,没有就不需要
|
//jedis.auth("uThyLr0gKTCf");
|
System.out.println("连接成功");
|
//jedis.set("doctor:id:1285860235186212861", "{\"id\": \"1612407967685\", \"name\" : \"程和\", \"portrait\": \"http://cdn2.wildfirechat.cn/robot.png\", \"roletype\": 1,\"mobile\": \"12211112222\"} ");
|
if (jedis.exists("doctor:id:1285860235186212861"))
|
jedis.del("doctor:id:1285860235186212861");
|
jedis.set("doctor:id:1285860235186212861", "{\"id\": \"1612407967685\", \"name\" : \"程6123467和\", \"portrait\": \"http://cdn2.wildfirechat.cn/robot.png\", \"roletype\": 1,\"mobile\": \"12211112222\"} ");
|
jedis.expire("doctor:id:1285860235186212861", 30);
|
jedis.close();
|
//查看服务是否运行
|
System.out.println("服务正在运行: "+jedis.ping());
|
}
|
|
}
|