Commit 6cc206a0 by tangzy

改用redis的连接

parent 02d857a4
...@@ -107,8 +107,6 @@ public class RedisUtil { ...@@ -107,8 +107,6 @@ public class RedisUtil {
} }
public static void set(String key, Object value, int sessionTimeOut) throws Exception { public static void set(String key, Object value, int sessionTimeOut) throws Exception {
// checkRedisNodeAvailable();
try { try {
masterNode.opsForValue().set(key, value); masterNode.opsForValue().set(key, value);
masterNode.expire(key, sessionTimeOut, TimeUnit.SECONDS); masterNode.expire(key, sessionTimeOut, TimeUnit.SECONDS);
...@@ -119,33 +117,31 @@ public class RedisUtil { ...@@ -119,33 +117,31 @@ public class RedisUtil {
} }
public static Object get(String key) throws Exception { public static Object get(String key) throws Exception {
// checkRedisNodeAvailable();
// Object values=null;
try { try {
return masterNode.opsForValue().get(key); return masterNode.opsForValue().get(key);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
checkRedisNodeAvailable();
} }
return null; return null;
} }
public static Boolean delete(String key) throws Exception { public static Boolean delete(String key) throws Exception {
// checkRedisNodeAvailable();
try { try {
return masterNode.delete(key); return masterNode.delete(key);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
checkRedisNodeAvailable();
} }
return false; return false;
} }
public static Set keys(String key) throws Exception { public static Set keys(String key) throws Exception {
// checkRedisNodeAvailable();
try { try {
return masterNode.keys(key + "*"); return masterNode.keys(key + "*");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
checkRedisNodeAvailable();
} }
return new HashSet(); return new HashSet();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment