package chat.redis; import redis.clients.jedis.Jedis; public class RedisUtil { public static boolean createRedisKey(String key, String jsonStr) { boolean result = false; try { Jedis jedis = new Jedis("139.196.115.152"); jedis.auth("uThyLr0gKTCf"); if (jedis.exists(key)) jedis.del(key); jedis.set(key, jsonStr); jedis.expire(key, 2592000); jedis.close(); result = true; } catch (Exception e) { result = false; e.printStackTrace(); } return result; } }